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 -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -