Nullable DateTime in .NET 2.0

Thanks to generics in 2.0, now any value type can be NULL.

    public class DateTimeNullTest
{
private Nullable<DateTime> oDate = new Nullable<DateTime>(DateTime.Now);

public DateTimeNullTest()
{
// Yay - It doesn't blow up!
if (oDate != null)
oDate = null;
}
}

 


AddThis Social Bookmark Button var addthis_pub = ‘alashcraft’;

Technorati tags: , , , ,
Mastodon
github.com/alvinashcraft