title: How can I get a collection's parent object?
body: <p>In C#, if I have an object that has a collection, is it possible to retrieve the object that contains the collection?</p>
  
  <p>Here is an example:</p>
  
  <pre><code>public class TestObject
  {
      public string name { get; set; }
      public TestObjectCollection testObjects{ get; set; } 
  }
  </code></pre>
  
  <p>The <code>TestObjectCollection</code> collection inherits from <code>CollectionBase</code> and is a collection of <code>TestObjects</code>.</p>
  
  <p>Here is an example implementation:</p>
  
  <ul>
  <li>A <code>TestObject</code> is created with a name of <code>"Test1"</code></li>
  <li>The <code>TestObject</code> with the name of <code>"Test1"</code> has a <code>TestObjectCollection</code>
  with a <code>TestObject</code> with a name of <code>"Test2"</code></li>
  </ul>
  
  <p>If I have the <code>TestObject</code> with the name of <code>"Test2"</code>, how can I get the <code>TestObject</code> with the name of <code>"Test1"</code></p>
  
  <p>Thanks</p>