.net Generic Calls <T>

Posted by Ryan on Stack Overflow See other posts from Stack Overflow or by Ryan
Published on 2010-03-16T18:25:57Z Indexed on 2010/03/16 18:31 UTC
Read the original article Hit count: 201

Filed under:
|

I have a function that accepts a generic parameter T that is of type class like so :

public  Func<T, bool> MyMethod<T>(string paramName, object value) where T : class

But when calling the function I do not have direct access to the class that needs to be the parameter.

MyMethod<foo>("foo1", "foo2")

Is there a way I can get the class foo via other means like reflection so I can use the function?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about generics