We noticed that lots of bugs in our software developed in C# (or Java) cause a NullReferenceException.
Is there a reason why \"null\" has even been included in the l
Null is an extremely powerful feature. What do you do if you have an absence of a value? It's NULL!
One school of thought is to never return null, another is to always. For example, some say you should return a valid but empty object.
I prefer null as to me it's a truer indication of what it actually is. If I can't retrieve an entity from my persistence layer, I want null. I don't want some empty value. But that's me.
It is especially handy with primitives. For example, if I have true or false, but it's used on a security form, where a permission can be Allow, Deny, or not set. Well, I want that not set to be null. So I can use bool?
There are a lot more I could go on about, but I will leave it there.