A
akolsen
Hello there.
This should be simple, but im having trouble anyway of getting it to
work.
I have a boxed object that i want to cast to its native type, but I
would like to use reflection to do the typecasting.
This is the regular way.
object obj = new Foo();
.... some dynamic invokation
Foo real = (Foo)obj;
real.DoSomething()
I would like it to do like the following
object obj = new Foo();
....
Foo real = (cast to typeof obj.getType() ) obj;
real.DoSomething()
Is it possible to do this dynamicly?
This should be simple, but im having trouble anyway of getting it to
work.
I have a boxed object that i want to cast to its native type, but I
would like to use reflection to do the typecasting.
This is the regular way.
object obj = new Foo();
.... some dynamic invokation
Foo real = (Foo)obj;
real.DoSomething()
I would like it to do like the following
object obj = new Foo();
....
Foo real = (cast to typeof obj.getType() ) obj;
real.DoSomething()
Is it possible to do this dynamicly?