I need to get type of an object in base type. However I can't use BaseType, because I can't know how many levels of types the object has.
class Base
{
public string Name { get set; }
public DoAThing()
{
Type myType = GetType(); // returns Derived
}
}
class Derived : Base
{
public int Age { get; set; }
public void DoSomething()
{
DoAThing();
}
}
Is it possible to have in myType Base type?