Invoking "Explicit type argument" methods with reflection ? Possib

21/12/2009 - 13:54 von Milan | Report spam
Hi all,

I need to reimplement the following function call "Cast<IMyClass>()" using
reflection:
IEnumerable<IMyClass> tMyList = wrapper ( ).Cast<IMyClass>();

declaration of wrapper is:
object wrapper ( );

wrapper() method returns "object" which is initialized inside "wrapper" with
the object of type "IList<MyClass>"

dec.of class
class MyClass: IMyClass {}

since wrapper returns "object" which does not have directlly accesible
"Cast" method I would like with reflection to call method "Cast<IMyClass>()",
how ?
How reflection is used in the case of using "explicit type argument"
<IMyClass> ?

Br,
Milan.
 

Lesen sie die antworten

#1 Milan
21/12/2009 - 15:41 | Warnen spam
eEntschuldigung ich habe doppelte Eintrag gemacht. Schauen Sie bitt nur ein
Eintrag oben.
Grüß,
Milan.

"Milan" wrote:


Hi all,

I need to reimplement the following function call "Cast<IMyClass>()" using
reflection:
IEnumerable<IMyClass> tMyList = wrapper ( ).Cast<IMyClass>();

declaration of wrapper is:
object wrapper ( );

wrapper() method returns "object" which is initialized inside "wrapper" with
the object of type "IList<MyClass>"

dec.of class
class MyClass: IMyClass {}

since wrapper returns "object" which does not have directlly accesible
"Cast" method I would like with reflection to call method "Cast<IMyClass>()",
how ?
How reflection is used in the case of using "explicit type argument"
<IMyClass> ?

Br,
Milan.

Ähnliche fragen