我正在尝试构建一个可以确定自己类型的基类,但我不知道该怎么做,显然这个.GetType在typeOf中不起作用,所以有没有办法获取类的类型目前的课程?
class BassClass {
public string GetValueofSomething() {
Type type = typeof(this.GetType()); //this obviously doesn't work
type = typeOf(BaseClass); //works fine
MemberInfo[] members = type.GetMembers();
//Other stuff here
return ""
}
}
Run Code Online (Sandbox Code Playgroud) c# ×1