|和||以及&和&&

本文详细介绍了C#中的逻辑运算符,包括按位或、条件或、按位与及条件与运算符,并解释了它们的使用场景和优先级。对于整型和枚举类型,这些运算符通常被允许使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://msdn.microsoft.com/en-us/library/6a71f45d.aspx

Logical OR Operator 按位或

This operator has higher precedence than the next section and lower precedence than the previous section. NOTE, you can click on the operator to go the details page with examples.

x | y – logical or bitwise OR. Use with integer types and enum types is generally allowed.

 

Conditional OR Operator  条件或

This operator has higher precedence than the next section and lower precedence than the previous section. NOTE, you can click on the operator to go the details page with examples.

x || y – logical OR. If the first operand is true, then C# does not evaluate the second operand.

 

Logical AND Operator  按位与

This operator has higher precedence than the next section and lower precedence than the previous section. NOTE, you can click on the operator to go the details page with examples.

x & y – logical or bitwise AND. Use with integer types and enum types is generally allowed.

 

 

Conditional AND Operator  条件与

This operator has higher precedence than the next section and lower precedence than the previous section. NOTE, you can click on the operator to go the details page with examples.

x && y – logical AND. If the first operand is false, then C# does not evaluate the second operand.

 

 

http://yyys8517750.iteye.com/blog/1258457

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值