title: Properties vs Public member variables
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/295104/what-is-the-difference-between-a-field-and-a-property-in-c-sharp">What is the difference between a field and a property in C#</a>  </p>
  </blockquote>
  
  
  
  <p>I'm a beginning programmer and I've read all about class properties. Books state that properties allow you to indirectly access member variables. Ok, so what makes it any different than just making the field public and accessing it directly?</p>
  
  <p>Here's a quote from Learning C# 3.0 by Jesse Liberty: </p>
  
  <blockquote>
    <p>For example, you might want external
    classes to be able to read a value, but not change it; or you might want to write
    some code so that the internal field can accept only values in a certain range. If you
    grant external classes free access to your member fields, you can’t control any of that.</p>
  </blockquote>
  
  <p>I don't understand what he is saying here. Can someone further explain this or give an example of why I would want to use a property over making the field public. As I understand it now they would both accomplish the same exact thing...so I'm obviously missing something here.</p>