How could I pass the type using Variables to the generic method???

Posted by Sam Zhou on Stack Overflow See other posts from Stack Overflow or by Sam Zhou
Published on 2010-03-18T09:35:43Z Indexed on 2010/03/18 9:41 UTC
Read the original article Hit count: 339

Filed under:
|
|

Hi All,

I have a generic method in c#:

public IList<T> getList<T>();

When I call it as the way below?

...
Type T1=metadata.ModelType;
getList<T1>();

...

I got error in compiling.

How could I do for it? I really need to pass the type as Variables to the generic method!

© Stack Overflow or respective owner

Related posts about generic

Related posts about type