title: How to pass a "path" to an object member in C#?
body: <p>Say I have</p>
  
  <pre><code>public class family
  {
     public person father;
     public person mother;
     public person[] child;
  }
  
  public class person
  {
     public string name;
     public int age;
  }
  </code></pre>
  
  <p>What I want to do is add a function to family that will allow me to specify the location I want a new person saved to.</p>
  
  <p>If there were C I would pass in a pointer to person so I could point it at a new person but I am somewhat new to C# and don't know what to do here. So I want it to look something like this:</p>
  
  <pre><code>public void SavePerson(int newAge, string newName, ??? location)
  {
     person addMe = new person();
     addMe.age = newAge;
     addMe.name = newName;
     location = addMe;
  }
  </code></pre>
  
  <p>I don't want to change the previous content of location. If it used to point at Frank, I want to keep Frank just the way he was, I just want it to now point at John (because other things may still be pointing at Frank)</p>
  
  <p>The reason I need this is because I have an interface and classes much more complicated than this. But there is one class I need to create and save a lot (and it appears all over in a large NHibernate created object) and I would like to roll that into one function for simplicity's sake.</p>