主页 HomePage

布尔类型 Boolean

public readonly struct Boolean

代表了布尔值, 有且仅有两种可能值: true和false. 这两种值的字符串形式就是: Boolean.TrueString和Boolean.FalseString

当声明Boolean变量, 但没有赋值的时候, 默认值是 false, 而不是 null.

注意: System.Boolean类型实际上需要占用一个字节(八位比特), 也即是1 Byte(8 bits).

布尔类型有三个常用逻辑运算符:

字段 Filed

public static readonly string FalseString

public static readonly string TrueString

方法 Method

public static bool TryParse(string value, out bool result)

public static bool TryParse(ReadOnlySpan<char> value, out bool result)