3 ms·
If I read that correctly, what they're actually introducing is a compiler setting (defaulted to off) to have it issue a warning when you assign a null or possib
by bunderbunder 8y ago
If I read that correctly, what they're actually introducing is a compiler setting (defaulted to off) to have it issue a warning when you assign a null or possibly-null value to a reference that wasn't explicitly annotated to indicate that it expects null.
But even with the setting turned on, you're still free to ignore the compiler warnings (assuming you haven't also told it to treat warnings as errors) and blithely assign null to a reference that wasn't flagged as nullable. So it's not quite non-nullability.
Which isn't to say that it's a misfeature. It's a huge step in the right direction that will be immensely helpful, and they managed to do it in a way that doesn't break the mountains of C# code that already exist. These sorts of methodical, well-considered design decisions that keep the language moving steadily forward without causing chaos for its users are exactly what's so great about the C# team.