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:
Using Nullable Types (C# Programming Guide)
SQL-CLR Type Mismatches (LINQ to SQL)