C# bool? 的意思

bool? is nullable while bool is not.

bool? first; bool second;

In the above code, first will be null while second will be false.

 

The ? symbol after a type is only a shortcut to the Nullable typebool? is equivalent to Nullable<bool>.

bool is a value type, this means that it cannot be null, so the Nullable type basically allows you to wrap value types, and being able to assign null to them.

bool? can contain three different values: truefalse and null.

x        y      x & y   x | y 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


REF: https://stackoverflow.com/questions/1181491/whats-the-difference-between-bool-and-bool

转载于:https://www.cnblogs.com/watermarks/p/8469780.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值