DEV Community

Discussion on: Why null in C# is so bad

Collapse
 
thebuzzsaw profile image
Kelly Brown

I still find the option of returning null from a method (like, if you didn't find what you're looking for in the database, for example) quite attractive and easy to handle.

I don't think this is being contested by anyone. However, if a method returns a string, I have no choice but to read the documentation or source code to know whether null is a legal return value. The thing I like about nullable references is that string? makes it 100% clear that null can and will happen.