New Features in C# 2.0—Nullable Types: What about

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Tutorials
C# Tutorials

New Features in C# 2.0

© 2005 O'Reilly Media, Inc.

What about…

…Boolean null values? How are they compared to correspond to the SQL three-value Boolean type?

C# provides two new operators:

bool? operator &(bool? x, bool? y)
bool? operator |(bool? x, bool? y)

You can use these operators to create the truth table depicted in Table 1-1.


If x is… And y is… x and y evaluate to… x|y evaluates to…
True True True True
True False False True
True Null Null True
False True False True
False False False False
False Null False Null
Null True Null True
Null False False Null
Null Null Null Null


Previous_Page_.gif Next_Page_.gif


Personal tools