generics - Why <T> is placed after method name for some extension methods in C# -


i looking @ answer of stackoverflow learn more c# extension methods. couldn't understand part <t> after method name. more exact:

public static bool in<t>(this t source, params t[] list) {   if(null==source) throw new argumentnullexception("source");   return list.contains(source); } 

i can understand t refers generic name class. why need <t> after method name extension method?

because method needs generic in order operate on instances of given type, represented t. <t> tells compiler method generic type parameter t. if leave out, compiler treat t actual type, of course purpose isn't.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -