Saturday 7 June 2008

Nullable Types in C#.NET

Nullable types allow other value types to be represented as a "null value".

Both examples produce the same result, but I prefer the first because it confuses the hell out of people who don't know it's meaning and requires less coding:

int? x = null;
Nullable<int> y = null;

No comments: