Thursday, June 30, 2011

C# Shortcuts (Nullable objects)

The variable must have a value, can not be empty. Sometimes it would be convenient, it was possible to give a "null" (for example, undefined) variable. . NET 2.0 Nullable general use, that makes this possible. The next two lines to produce exactly the same purpose:


Nullable myVar = null;
or use this...
int? myVar = null;
By one ? According to a definition of the variable, the compiler will wrap a Nullable  generic type.

No comments:

Post a Comment