Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

bool: practical reference

bool: practical reference: bool is the System.Boolean alias with true and false values.

Version: C# built-in type reference; .NET 10 runtime

Syntax

bool value

bool is the System.Boolean alias with true and false values.

Use it for two-state conditions; use bool? explicitly for three states.

It does not convert implicitly from numbers as in C or C++.

Its default is false, and && and || use short-circuit evaluation.

The complete program actually uses bool; its exact expected stdout is System.Boolean.

Examples

using System;

Console.WriteLine(typeof(bool).FullName);

Result

System.Boolean

The complete program actually uses `bool`; its exact expected stdout is `System.Boolean`.

Sources