I noticed today that if you declare a nullable DateTime object you don't get the same set of functions as you do when you have a standard DateTime object.
For example:
DateTime? nullableDT = DateTime.Now;
DateTime regularDT = DateTime.Now;
in the code above nullableDT cannot use any of the following functions:
ToFileTime
ToFileTimeUtc
ToLocalTime
ToLongDateString
ToLongTimeString
ToOADate
ToShortDateString
ToShortTimeString
ToString(IFormatProvider)
ToString(String)
ToString(String, IFormatProvider)
ToUniversalTime
This is the short list, there are many more methods not available.
Why is .NET behaving like this? I worked around it by throwing a Convert.ToDateTime()
around my nullable date but that seems krufty... Is there a better way?