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

Flippant Remarks about Identifying a Nullable Type

Look here, "How to: Identify a Nullable Type (C# Programming Guide)":

http://msdn2.microsoft.com/en-us/library/ms366789(vs.80).aspx

"You can use the C# typeof operator to create a Type object that represents a Nullable type... The C# is operator also operates on a Nullable's underlying type. Therefore you cannot use is to determine whether a variable is a Nullable type."

The Boolean test:

if (type.IsGenericType &&
    type.GetGenericTypeDefinition() == typeof(Nullable<>)) {…}
mod date: 2007-06-18T19:09:33.000Z