first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

Nullable<T> Usage Guidelines; Krzysztof Cwalina

CONSIDER using Nullable<T> to represent values that might not be present (i.e. optional values).

Do NOT use Nullable<T> unless you would use a reference type in a similar manner, taking advantage of the fact that reference type values can be null.

AVOID using Nullable<bool> to represent a general three-state value.

AVOID using System.DBNull. Prefer Nullable<T> instead.

Nullable<T> is in general a better representation of optional database values. One thing to consider though it that while Nullable<T> gives you the ability to represent null values, you don’t get database null operational semantics. Specifically, you don’t get null propagation through operators and functions. If you deeply care about the propagation semantics, consider sticking with DBNull.

[http://blogs.msdn.com/kcwalina/archive/2008/07/16/Nullable.aspx]

mod date: 2008-08-25T02:16:46.000Z