need to assign null

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top