Another solution similar to the accepted is to use C#'s default keyword. While defined using generics, it is actually applicable to any type.
Example usage applied to the OP's question:
Nullable<DateTime> foo; foo = true ? default(DateTime) : new DateTime(0); Example usage with the current accepted answer:
DateTime? foo; foo = true ? default(DateTime) : new DateTime(0); Also, by using default, you do not need to specify the variable as nullablenullable in order to assign it a null value. The compiler will auto-assign the specific variable-type's default value (in the case of DateTime, it is null) and no error will be encountered. Example:
DateTime foo; foo = true ? default(DateTime) : new DateTime(0);