469,934 Members | 1,873 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

can someone explain this nullable datetime error to me


Using vs2008 c#

i have this code snipet note: SUBMITTED_DT = DateTime? type

if ((DateTime.Now - billingEvent.SUBMITTED_DT).Days 180)
{
throw new
BusinessException(Messages.BillingEvent_Save_TooOl d);
}
this causes an error on build saying .Days is not supported, and
asking if i am missing an assembly reference.
if i change the code to (ie add SUBMITTED_DT.Value)

if ((DateTime.Now - billingEvent.SUBMITTED_DT.Value).Days 180)
{
throw new
BusinessException(Messages.BillingEvent_Save_TooOl d);
}

then this builds ok, i know its something to do with using DateTime?
but i dont realy understand why.

Can anyone give me a Captain Dummy explanation of why .Value is
required ?
thanks

Peter
Oct 24 '08 #1
2 1219
On Thu, 23 Oct 2008 22:14:43 -0700, <Petedwrote:
I see. Ok thanks for that, that makes sense
I'm glad it makes sense to you. Reading it again, I'm not sure it makes
sense to me. The word "nullable" shows up so often, the whole thing seems
a bit like a blur to me. :)

But, if you're happy...I'm happy. :)
Oct 24 '08 #2

I thought that explanation was fine, actually, it does make sense to
me

thanks

Peter
>On Thu, 23 Oct 2008 22:14:43 -0700, <Petedwrote:
>I see. Ok thanks for that, that makes sense

I'm glad it makes sense to you. Reading it again, I'm not sure it makes
sense to me. The word "nullable" shows up so often, the whole thing seems
a bit like a blur to me. :)

But, if you're happy...I'm happy. :)
Oct 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by ESPNSTI | last post: by
reply views Thread by pranesh.nayak | last post: by
15 posts views Thread by scparker | last post: by
5 posts views Thread by =?Utf-8?B?emlubw==?= | last post: by
3 posts views Thread by =?Utf-8?B?V2FubmFiZQ==?= | last post: by
2 posts views Thread by Andrus | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.