The following code compiles:
class Testing<TKey, TValue>
{
public bool Test(TKey key)
{
return key == null;
}
}
However, TKey can be a value type, and possibly not allow the value "null".
I know the results of this program, and how to add constraints. What I'm wondering is why doesn't the compiler disallow this when TKey is not constrained to "class"?