C# Language Keywords bool

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Keyword for storing the Boolean values true and false. bool is an alias of System.Boolean.

The default value of a bool is false.

bool b; // default value is false
b = true; // true
b = ((5 + 2) == 6); // false

For a bool to allow null values it must be initialized as a bool?.

The default value of a bool? is null.

bool? a // default value is null


Got any C# Language Question?