In C#, What is <T> After a Method Declaration?

Posted by Drew on Stack Overflow See other posts from Stack Overflow or by Drew
Published on 2010-04-30T15:52:03Z Indexed on 2010/04/30 15:57 UTC
Read the original article Hit count: 243

Filed under:
|
|

I'm a VB.Net guy. (because I have to be, because the person who signs my check says so. :P) I grew up in Java and I don't generally struggle to read or write in C# when I get the chance. I came across some syntax today that I have never seen, and that I can't seem to figure out.

In the following method declaration, what does < T > represent?

static void Foo < T >(params T[] x)

I have seen used in conjunction with declaring generic collections and things, but I can't for the life of me figure out what it does for this method.

In case it matters, I came across it when thinking about some C# brain teasers. The sixth teaser contains the entire code snippet.

© Stack Overflow or respective owner

Related posts about c#

Related posts about method