[Solved] How to get which Type of parent object to reference the current object via property


You could pass the “parent” object as a parameter to the C constructor:

public class C
{
    private readonly object _parent;
    public C(object parent)
    {
        _parent;
    }

    public void Do()
    {
        Type type = _parent != null ? _parent.GetType() : null;
        // Do something with type...
    }
}

solved How to get which Type of parent object to reference the current object via property