title: Why use getters and setters in c#
body: <p>I have used two ways for setting up a public class in C# (and VB.NET)</p>
  
  <h2>Option 1 - Setters &amp; Getters</h2>
  
  <pre><code>public class foo
  {
    private string _bar;
    public string bar
    {
      get { return _bar; }
      set { _bar = value; }
    }
  }
  </code></pre>
  
  <h2>Option 2 - Simple Public Class</h2>
  
  <pre><code>Public Class foo
      Public string bar = "";   
  End Class
  </code></pre>
  
  <p>I've done it both ways, but it's much simpler and less code with Option 2 - and I don't see the difference in terms of other coding to set or get values for the class or performance - both ways work just fine.</p>
  
  <p>My question is "Why would you do Option 1 if there are not some other 'special things' happening in the getter or setter? And if so - what would those reasons potentially be?</p>
  
  <p>What I want to know if there's some 'Convincing Argument' for using setters and getters for this and if so 'Specifically Why?</p>
  
  <p>Cheers, Charlez</p>