Let’s say your program needs to work with a date and time value. Normally you’d use a
DateTime variable. But what if that variable doesn’t always have a value? That’s where
nullable types comes in really handy. All you need to do is add a question mark (?) to the end
of any value type, and it becomes a nullable type that you can set to null.
bool? myNulableInt = null;
DateTime? myNullableDate = null;
You will find out that the question mark T? is an alias for Nullable<T>.
Comments
Post a Comment