When to use get and set in C# class declaration
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/653536/difference-between-property-and-field-in-c-sharp-net-3-5">Difference between Property and Field in C# .NET 3.5+</a>  </p>
</blockquote>



<p>What's the difference between using </p>

<pre><code>public string Username { get; set; }
</code></pre>

<p>and using </p>

<pre><code>public string Username;
</code></pre>

<p>I have always been using the first one, but wanted to understand if there is any difference between the two, and scenarios when one should prefer over the other.</p>
