Is there a way to get the current class instance (equivalent to 'this') except as the Type of the subclass, in a superclass?
When I do something similar (It's too big and complicated to show the actual code, I'm just hoping this works the same) to the following the type that gets supplied to C.DoStuff() is an instance of A, not B. I'm doing Reflection work on the Properties of a class and because it's of type A I don't get the Properties from type A
class A
{
public void DoStuff()
{
C.DoStuff(this);
}
}
class B : A
{
}
class C
{
public static void main(string[] args)
{
A inst = new B();
inst.DoStuff();
}
public static void DoStuff<T>(T obj) {//do reflection on generic type}
}