They usually involve generics. But some methods with generics don’t have them, and not all extension methods have them.
They’ve just “been there” since day one, we’ve all seen them; but I realized I still don’t know what they mean, and I can’t find the answer anywhere. Now it’s really bugging me. Google just turns up results that are about XML, etc.
Is this officially documented anywhere? Thanks.
EDIT: Well that’s just great. Since I just created an account to make my first Stack Overflow post, to get an answer for this burning question; I’m not allowed to post my pretty Intellisense picture, or create a new tag “angle-brackets”. I love Stack Overflow, but… what a welcome!
Maybe my problem is that they aren’t actually called “angle brackets”… ??
Anyway, I guess if you really want to see my beautiful screenshot you could manually go to:
Distinct>< http://www.freeimagehosting.net/uploads/6a6c2f3268.png
Bump me up please so I can include it in the post, thanks. 😉
These methods are generic.
However, the compiler automatically infers the generic type parameter from the method call, so you don’t need to use the brackets when calling the method.
For example, if you have an
IEnumerable<int> myNumbers, the following four statements are equivalent:In the first and third calls, the compiler infers the
intparameter becausemyNumbersis anIEnumerable<int>.The
Countextension method is declared (in System.Core.Dll) like this: