Saturday, August 19, 2006

Nullable Types

I have yet to work extensively with nullable types, a new addition to C# 2.0. A nullable type can represent the normal range of values for its underlying value type, plus an additional null value. This is somewhat similar to how SQL allows you to create an int datatype column that allows a null value. To declare a nullable type, you use the '?' operator. For example, int? num = null;

More on the C# 2.0 Nullable Types
Jon Skeet's Blog : Elegant comparisons with the null coalescing operator
Jon Skeet's Blog : Nullable types and the null coalescing operator
MSDN Reference : ?? Operator (C# Reference)
MSDN Reference : Nullable Types (C# Programming Guide)

No comments: