问题
Assuming C# 8.0 and reference type nullability, why are these signatures considered equal:
void Test<T>(IEnumerable<T> enumerable) where T : class
void Test<T>(IEnumerable<T> enumerable) where T : struct
but these are not?
void Test<T>(IEnumerable<T?> enumerable) where T : class
void Test<T>(IEnumerable<T?> enumerable) where T : struct
The only thing different is the nullability of enumerable elements.
来源:https://stackoverflow.com/questions/60115233/same-method-signature-confusion