I have this class structure :
class A { }
class B:A { }
A x = new B();
this is the runtime type :
x.GetType(); //B
How can i get its compile time type ?
I tried typeof (x) – but the argument has to be a type…
my desire answer is : A
edit
why am i asking it ?
cause i think int is inistialized via polymorphic engine :
something like this :
object myInd = new Int32(); / /this DOES compile
and i want to verify my assumption :
does it come from object ?
and in order to do it – i have to know its static type….
You can create a generic method:
To call it:
It’s a solution – even though I don’t see what the problem solved with the solution is 😉