need to assign null

G

Guest

hey all,
i have a String that i need to DateTime.Parse() and if a FormatException
occurs I need to assign a null to my DateTime variable. The only way i know
to do this is DateTime.MinValue or .MaxValue.

Does this still stand? And are there any caveats doing it this way?

thanks,
rodchar
 
M

Michael Nemtsev

Hello rodchar,

It's ok to use MinValue as the value by default.

PS: You can use DateTime.TryParse

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

r> hey all,
r> i have a String that i need to DateTime.Parse() and if a
r> FormatException
r> occurs I need to assign a null to my DateTime variable. The only way
r> i know
r> to do this is DateTime.MinValue or .MaxValue.
r> Does this still stand? And are there any caveats doing it this way?
r>
r> thanks,
r> rodchar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top