Wednesday, June 11, 2008

Declaring variables as nullable in C#

Nullable variables can be declared if you want to determine whether a value has been assigned or not.

Two ways:

1. Use Nullable type
Nullable b = null;

2. Use C# shorthand notation
bool? b = null;

No comments: