3 ms·
> Languages like Java, Ruby, and C# all make the mistake of allowing any type at all to hold null. Just a little nitpicking here. In C# integral types cannot h
by oozcitak 16y ago
> Languages like Java, Ruby, and C# all make the mistake of allowing any type at all to hold null.
Just a little nitpicking here. In C# integral types cannot hold null unless explicitly declared nullable [1], ie.
int x = null; // won't compile
int? x = null; // compiles fine, shorthand for Nullable<int> x = null;
I wish this was the default behavior for reference types, too.
[1]: http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx