DateTime.MinValue vs new DateTime() in C#

Posted by MadBoy on Stack Overflow See other posts from Stack Overflow or by MadBoy
Published on 2010-03-16T09:17:44Z Indexed on 2010/03/16 9:26 UTC
Read the original article Hit count: 648

Filed under:
|
|

When getting SQL DateTime Resharper suggests to use new DateTime() when value is DBNull.Value. I've always used DateTime.MinValue. Which is the proper way?

DateTime varData = sqlQueryResult["Data"] is DateTime ? (DateTime) sqlQueryResult["Data"] : new DateTime();

© Stack Overflow or respective owner

Related posts about c#

Related posts about datetime