As I started looking at LINQ, I’m running into some interesting scenarios regarding nullable boolean values. We all know how SQL allows for a BIT to be 3 values: True, False or NULL. We also know that in SQL, handling NULLs in comparisons requires special attention. For the most part NULL does not equal NULL.

The use of LINQ brings this concept and scenario up into the .NET programming world. Now I need to be careful about conditionals that include Nullable(Of Boolean).

I won’t repeat all the information here, but please read the following articles that explain this in good detail:

Nullable Types
http://msdn.microsoft.com/en-us/library/bb981315(VS.80).aspx

Using Nullable Types (C# Programming Guide)
http://msdn.microsoft.com/en-us/library/2cf62fcy.aspx

SQL-CLR Type Mismatches (LINQ to SQL)
http://msdn.microsoft.com/en-us/library/bb386909.aspx