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: , , , ,

Post to Twitter Tweet This Post

Leave a comment

Please be polite and on topic. Your e-mail will never be published.

About Me

I am a Philadelphia-area .NET developer, Microsoft MVP, husband, dad, and geek. I am currently a software engineer at Eclipsys Corporation. I have over 15 years of software development experience in the Healthcare and Manufacturing industries.

More...

Categories

Archives