title: Shorthand Accessors and Mutators
body: <p>I am learning C#, and am learning about making fields private to the class, and using Getters and Setters to expose Methods instead of field values.</p>
  
  <p>Are the <code>get; set;</code> in <em>Method 1</em> and <em>Method 2</em> equivalent? e.g. is one a shorthand of the other?</p>
  
  <pre><code>class Student
  {
      // Instance fields
      private string name;
      private int mark;
  
      // Method 1
      public string Name { get; set; }
  
      // Method 2
      public int Mark
      {
          get { return mark; }
          set { mark = value; }
      }
  }
  </code></pre>
  
  <p>Finally, would <em>Method 2</em> be used when you want to for example perform a calculation before getting or setting a value? e.g. converting value to a percentage or perform validation? e.g.</p>
  
  <pre><code>class Student
  {
      // Instance fields
      private string name;
      private double mark;
      private int maxMark = 50;
  
      // Method 1
      public string Name { get; set; }
  
      // Method 2
      public double Mark
      {
          get { return mark; }
          set { if ( mark &lt;= maxMark ) mark = value / maxMark * 100; }
      }
  }
  </code></pre>