网站备案证明,深圳网页设计培训学校,wordpress canvas,箱包官方网站模板 运算符既可作为一元运算符也可作为二元运算符。 备注 一元 运算符返回操作数的地址#xff08;要求 unsafe 上下文#xff09;。 为整型和 bool 类型预定义了二进制 运算符。 对于整型#xff0c; 计算操作数的逻辑按位“与”。 对于 bool 操作数 运算符既可作为一元运算符也可作为二元运算符。 备注 一元 运算符返回操作数的地址要求 unsafe 上下文。 为整型和 bool 类型预定义了二进制 运算符。 对于整型 计算操作数的逻辑按位“与”。 对于 bool 操作数 计算操作数的逻辑“与”也就是说当且仅当两个操作数均为 true 时结果才为 true。 运算符计算两个运算符与第一个操作数的值无关。 例如 1 int i 0;
2 if (false i 1)
3 {
4 // i is incremented, but the conditional
5 // expression evaluates to false, so
6 // this block does not execute.
7 } View Code 用户定义的类型可重载二元 运算符请参见 operator。 对于整数类型适用的运算对枚举类型通常也适用。 重载二元运算符时也会隐式重载相应的赋值运算符如果有。 示例 1 class BitwiseAnd2 {3 static void Main()4 {5 // The following two statements perform logical ANDs.6 Console.WriteLine(true false); 7 Console.WriteLine(true true); 8 9 // The following line performs a bitwise AND of F8 (1111 1000) and
10 // 3F (0011 1111).
11 // 1111 1000
12 // 0011 1111
13 // ---------
14 // 0011 1000 or 38
15 Console.WriteLine(0x{0:x}, 0xf8 0x3f);
16 }
17 }
18 // Output:
19 // False
20 // True
21 // 0x38 View Code 转载于:https://www.cnblogs.com/gamerLin/p/4446738.html