How to call a generic method through reflection

Posted by milan on Stack Overflow See other posts from Stack Overflow or by milan
Published on 2009-12-21T16:52:26Z Indexed on 2010/06/03 16:44 UTC
Read the original article Hit count: 194

Filed under:
|
|

Hi,

is it possible to call with reflection a method with "explict type argument" <S> definition
e.g. oObject.Cast<S>() ?

where is:

IList <P> oObject = new List <P>();

I tried with

oObject.getType().InvokeMember( "Cast", BindingFlags.InvokeMethod, null, oObject, null)

but it does not work, does anyone know why?

© Stack Overflow or respective owner

Related posts about c#

Related posts about reflection