public sealed class MyClass<T>
{
private T? myField;
}
This code compiles fine, yet when I use it with reference type (like T=string) I will get nullable myField
(as expected). But when I use value type (like int
) I will get non-nullable myField
which I didn't expect, especially considering lack of error.
Is it possible to write universal type holding nullable value or reference?