如何在基础中获取调用者类类型?
这是父母,这里我想打印子类型而不发送它
public abstract class Parent: ISomeInterface {
public void printChildType()
{
Type typeOfMyChild = ?????;
MessageBox.Show(typeOfMyChild); //how do I get Child typeOfMyChild
}
}
孩子
public class Child : parent {
}
打印孩子类型:
Child child = new Child();
child.printChildType();
谢谢
(我已经看过这个:在基静态类中获取继承的调用者类型名称,但我没有使用静态方法)