Nullable types are used when you need to represent the value of an underlying type. By default DateTime is not nullable in C# because it is a Value type, but using the Nullable
construct (or the ? shorthand), you can assign the null literal to the DateTime type. Syntax is below:
DateTime? dt = null;
Nullable<DateTime> dt = null;
No comments:
Post a Comment