REG GENERIC METHOD

Posted by googler1 on Stack Overflow See other posts from Stack Overflow or by googler1
Published on 2010-04-08T05:21:10Z Indexed on 2010/04/08 5:33 UTC
Read the original article Hit count: 348

Filed under:
|

Hi buddies,

I had a thought on using the generic method in c# as like we do in c++.

Normally a method looks like this:

public static (void/int/string) methodname((datatype) partameter)
{
              return ...;
}

I had a thought whether can we implement the generics to this method like this:

public static <T> methodname(<T> partameter)
{
              return ...;
}

Using as a generic to define the datatype.

Can anyone pls suggest whether the above declaration is correct and can be used in c#?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about generics