Big egos are big shields for lots of empty space.
Diana Black

An empty head is not really empty; it is stuffed with rubbish. Hence the difficulty of forcing anything into an empty head.
Eric Hoffer

Empty pockets never held anyone back. Only empty heads and empty hearts can do that.
Norman Vincent Peale

Databases allow for dates and numerical data to be null.  .NET structured data types do not allow for null.  For instance, DateTime, int, long, double, decimal, etc. do not allow for null values.

How should we handle this mismatch between database column and class property?  Database column allows null, class property does not.

Solution: Use a Nullable data type.  In C#, just add ? to the end of a structured data type to convert it to a Nullable data type.

How to check Nullable data types for null?  The following two methods are equivalent.

Sometimes a value is required for display purposes even when the value is null. You can use the short hand notation with the coalescing operator (??). The two snippets of code below are equivalent.


Leave a Reply