title: c# setting value of private variable
body: <p>i am using a getter/setter properties to get or set variables my code is working fine if i use the public variable for setting value as i am making a array of my class but i am just wondering how to set value of private variable . My code is</p>
  
  <pre><code>public class Person
  {
      //getter and setter for each variable
      private string _Name;
      public string Name
      {
          get { return _Name;}
          set { _Name= value; }
      }
  
      private int _Age;
      public int Age
      {
          get {return _Age;  }
          set  {  _Age= value;   }
      }  
          .... // other properties
  
      // Another Class 
      public void setValues (Person[] p,int i)
      {    p[i].Age= 30;
      }
  </code></pre>
  
  <p>But how to set the variable if i change my set variable to private ??</p>
  
  <pre><code>    private int _Age;
      public int Age
      {
         get {return _Age;  }
         private  set  {  _Age= value;   }
      } 
  </code></pre>