It just means that when limiting the type of value (second paragraph)
static bool TryToCompare<T>(T first, T second) where T : struct
{
return first == second;
return first.Equals(second);
}
Without limiting the type of value in the generic expression, he also talks about it (first paragraph)
static bool TryToCompare<T>(T first, T second)
{
return first == second;
return first == null;
return first.Equals(second);
}
If you restrict to Treference type, you can avoid using==
static bool TryToCompare<T>(T first, T second) where T : class
{
return first == second;
return first == null;
return first.Equals(second);
}
source
share