title: Should I use public properties and private fields or public fields for data?
body: <p>In much of the code I have seen (on SO, thecodeproject.com and I tend to do this in my own code), I have seen public properties being created for every single private field that a class contains, even if they are the most basic type of <code>get; set;</code> like:</p>
  
  <pre><code>private int myInt;
  public int MyInt 
  {
       get { return myInt; }
       set { myInt = value }
  }
  </code></pre>
  
  <p>My question is: how does this differ from:</p>
  
  <pre><code>public int MyInt;
  </code></pre>
  
  <p>and if we should use properties instead of public fields why should we use them in this specific case? (I am not talking about more complex examples where the getters and setters actually do something special or there is only one get or set (read/write only) rather than just returning/setting a value of a private field). It does not seem to add any extra encapsulation, only give a nice icon in IntelliSense and be placed in a special section in class diagrams!</p>