How do i assigned the type of any object to a .NET generic method?

Posted by Usman on Stack Overflow See other posts from Stack Overflow or by Usman
Published on 2010-03-30T05:45:25Z Indexed on 2010/03/30 6:23 UTC
Read the original article Hit count: 257

Filed under:
|

Suppose that I have created a method like this

private void Test<t>(t str)
{

}

Now from another method i call it

private void BtnClick()
{
    string a = "";


    test<Here I Want To assign The Type what ever the type of 'a' is>();
}

How can I do this ?

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics