If you don’t get this post that’s fine
What yahoo at Microsoft thought that smacking a ? at the end of a variable declaration made sense?
I ran across some docs on the newest .NET stuff today and I found out that in C# you can declare a Nullable integer like this:int? nMyNumber
WHAT!? Seriously, Microsoft has to do some extra drug testing or something.
That… stuff… is syntactically equivalent to:Nullable<int> nMyNumber which is far clearer than than the above.
My reasons are simple: You cannot communicate a declaration like that in normal human conversation if you rely on the conventions used within the code There’s no way to express there being a ? after that ‘int’ unless you shrug your shoulders or you actually say “Nullable int”.
Further, I can’t imagine the level of confusion encountered when you end an email with something like… “very odd because I declared it of type int?.” Or, “.. perhaps it should be of type int??” Or worse, “that idiot declared it of type int?!”.
I predict some confusion coming out of this, but as I don’t actually work with C# I probably won’t experience it first hand.
Oh, and yes, I know this is a silly thing to nitpick a language for, especially one that I’ve always found rather easy to work with.
Nullable types are pretty cool. Throw in generics and you got: List = new List(); thats pratically a full sentence!
meh stupid filter – List<int?> myList = new List<int?>();