I was looking at the answer of stackoverflow to learn more about C# extension methods. I couldn't understand the part <T>
after the method name. To be 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 for any class. Why do we need <T>
after the method name for this extension method?