How to get parent object from child object dynamically
<p>Is it possible to get the parent object from a child object dynamically?  Essentially, all I'm trying to accomplish is to dynamically retrieve the value of a property belonging to a child objects' parent. For example, something along the lines of the following:</p>

<pre><code>public T GetParentProperty&lt;T&gt;(object oChildObject, string sPropertyName)
{
    ??? oOwner;
    PropertyInfo oOwnerInfo;
    T oPropertyValue;

    try
    {
        oPropertyValue = null;
        if (oChildObject != null)
        {
            oOwner = oChildObject.GetType().???;
            oOwnerInfo = oOwner.GetType().GetProperty(sPropertyName);
            if (oOwnerInfo != null)
                oPropertyValue = oOwnerInfo.GetValue(oOwner, null) as T;
        }
    }
    catch(Exception oEx)
    {
        Console.WriteLine(oEx);
    }

    return oPropertyValue;
}
</code></pre>

<p>Many thanks in advance!</p>
