Matrix Unload

  NullableTypes on


Version: 1.2
Date: July 2004
Source Code: C#
Environment: .NET Framework
Supported languages: C#, VB.NET, ...
License: open source MIT License

If you've worked with the .NET built-in types (DateTime, Boolean, ...) you probably faced a little problem one day: these data types don't support the Null value. NullableTypes are the easy, intuitive, elegant and definitive solution!


NullableTypes for .NET are a very reliable and efficient version of built-in value-types that can be Null. NullableTypes pass more than 800 differents test cases and have close-to-optimal efficiency as built-in value-types. They may be used every time you need to store a Null value in a .NET built-in value-type.

Types implemented by NullableTypes are: NullableBoolean, NullableByte, NullableInt16, NullableInt32, NullableInt64, NullableSingle, NullableDouble, NullableDecimal, NullableString and NullableDateTime.
Helper functions provide seamless integration with Windows and ASP.NET user controls and with ADO.NET.

NullableTypes will let you write code like this:
        public sealed class Order{
             public int OrderID {get {/*...*/}}
             public int CustomerID {get {/*...*/}}
             public NullableDateTime RequestedDeliveryDate {get {/*...*/}}
             // remaining members elided for clarity
where RequestedDeliveryDate can be either NullableDateTime.Null or a valid DateTime value.
The property RequestedDeliveryDate.IsNull tests if the date is Null, and when it is not Null the property RequestedDeliveryDate.Value returns a valid DateTime value.


Sample Code >>>
Online documentation >>>


Binding with NullableTypes >>>
Strong typed Dataset with NullableTypes >>>
NullableTypes vs. SqlTypes >>>
NullableTypes vs. SqlTypes (more) >>>
C# 2.0 nullable types: what about? >>>
C# 2.0 nullable types: changing C# syntax or using an external library? >>>


Read release notes >>>
Download NullableTypes (765KB) >>>
Download NullableTypes Help for VS.NET 2003 (799KB) >>>


Help Forum >>>
Submit Bug Report >>>
Submit Feature Request >>>


Performance improvements:
Implement the type-safe version of Equals() and CompareTo() methods to reduce boxing/unboxing in the user code. Compare the performance of the actual implementation of Equals(object) with an alternative implementation. Apply here >>>

Complete MONO porting:
Submit bugs to the Mono team for the tests that actually fail due to Mono bugs and make tests pass. Apply here >>>