.Net 2.0 will have nullable value types (int, string, datetime, etc.) but we all know
that .Net 1.1 does not support them (SqlTypes are nullable though). The Nullable
Types project at SourceForge is a project that attempts to overcome this limitation.
It defines nullable types such as NullableBoolean, NullableInt32, NullableDecimal,
NullableString and NullableDateTime to be used as replacements for the built in .Net
value types. The wisdom of going with such a non-standard implementation is
questionable, but it is very interesting.
Some of the features of the project are:
-
Like SqlTypes the nullable types all implement INullable
-
The types are serializable unlike SqlTypes
-
You should use SqlTypes in your DA layer and NullableTypes in your Business and UI
layers
-
If the value is Null and you are converting to a standard .Net value type, such as
an int32, it will still throw an exception