3 ms·
>For example, to say that any class implements an interface is now nonsense - as long as nullable values are assignable to that type You're talking about a dif
by jasode 11y ago
>For example, to say that any class implements an interface is now nonsense - as long as nullable values are assignable to that type
You're talking about a different concept of "null" from the parent you're replying to (junto).
You're talking about "null" as invalid object reference (similar to uninitialized pointer in C/C++).
junto was asking about "null" as a sentinel value for semantics of "missing" or "unknown" data. This is a very desirable language feature to have. Your complaint about "null references" is valid but it's further confusing the misunderstanding junto appears to have about Nullable<T>.
Nullable<T> isn't about invalid object references. Instead, it's a convenient language feature that combines two booleans to expose the desirable semantics of a tri-state boolean. The 1st bool is the user named variable. The 2nd bool is the .HasValue property. Instead of explicitly setting .Hashvalue=false, C# just lets programmer use "null".