TipsOnLips.net

Your .net tips and tricks source

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010


Nullable object must have a value (C#)

If we assign a nullable object like DateTime to null like below,

nextRunDateTime = null;
DateTime? time = nextRunDateTime.Value;
We get an error of, Nullable object must have a value.
 
But if we use the same example above without the Value object:
nextRunDateTime = null;
DateTime? time = nextRunDateTime;
 
Then no error is generated
Reference: http://msdn.microsoft.com/en-us/library/1t3y8s4s(VS.80).aspx

Categories: C#
Posted by Admin on Friday, December 05, 2008 4:17 AM
Permalink | Comments (0) | Post RSSRSS comment feed
Comments are closed