I'm new to nullable types. I like them for adding a value that can mean "no set", but I don't like having to cast them back later on, or having to tack on the .Value.
Here's specifically my scenario in context of a wrapper class that implements one of my repository types:
public DateTime TimeCreated
{
get { return inner.TimeCreated.IsSet() ? inner.TimeCreated.GetValue() : DateTime.MaxValue; }
}
I'd like to change to using DateTime? but as I understand it, then when I access the property I have to use either (DateTime)TimeCreated or TimeCreated.Value and, for me, it kind of defeats the purpose of wrapping the type in the first place having to add verbosity to any code that accesses it.
Question: is there an easy workaround for this? Or am I missing some point, as I feel may be the case?