In .net 2.0, there is a new nullable type, which can be used to assign null values to basic value types, such as
int? k = 3;//A nullable value type (referred to as null type)
int m = null;//error
int? j = null;//Success From the above example, we can see that a nullable value type can be defined after the value type. In C#, a ? sign is added after the basic type, while in VB.NET In, you can do this
Dim dtmVarName As Nullable(Of DateTime)
Dim intVarName As Nullable(Of Integer)
Dim bVarName As Nullable(Of Boolean)
It should be noted that the null type is not a new .NET data type.
In fact, the null type is a generic class System.Nullable<T> defined in the .NET library, where T is a replaceable value type.
int? k = 3; can also be written as System.Nullable<int> k = 3;
The operations are implemented through operator overloading of this class.
You can use hasvalue to determine whether the empty type has been assigned a value
if (dtmVarName.HasValue)
{
//...do something
}
http://www.cnblogs.com/jackyrong/archive/2006/08/26/486796.html