title: Advantages of Properties in Classes
body: <p>I've been using classes for a while now, but I feel I may have been using them incorrectly.</p>
  
  <p>When I create the properties for the class, I just use public variables so I end up with something like the following:</p>
  
  <pre><code>Class clsMyClass
      Public Name As String
  End Class
  </code></pre>
  
  <p>However, I've been reading some info on the net and they suggest that it should be set up in the following way:</p>
  
  <pre><code>Class clsMyClass
      Private Name As String
  
      Property UsersName() As String
          Get
              Return Name
          End Get
          Set(ByVal Value As String)
              Name = Value
          End Set
      End Property
  End Class
  </code></pre>
  
  <p>Is the way I'm doing it extremely incorrect? If so, why? I feel like the second method adds some sort of security but to be honest, it just looks like unnecessary code..? </p>