I can define an extension method to determine if an object is null
public static bool IsNull(this object obj) {
if (obj == null)
return true;
else return false;
}
But I can also do this:
public static bool IsNull<T>(this T obj) {
if(obj == null)
return true;
else return false;
}
Both are being applied to every object. What's the purpose of this T? To further elaborate what type is being expected? If yes, why this: typeof(T)
is possible? And what's the reason behind (this doesn't work anyway as pointed out by @MatthewWatson)(this T obj) where T: int)
(where) then?
So many questions.