gpt4 book ai didi

c# - C# 中 &= 和 |= 运算符的用途是什么

转载 作者:行者123 更新时间:2023-11-30 13:38:22 25 4
gpt4 key购买 nike

<分区>

我不确定这些运算符正在完成什么:

byteInfo[x, y, z] |= (byte)info;

还有:

byteInfo[x, y, z] &= (byte)255 - (byte)info;

来自 msdn:

class AndAssignment
{
static void Main()
{
int a = 0x0c;
a &= 0x06;
Console.WriteLine("0x{0:x8}", a);
bool b = true;
b &= false;
Console.WriteLine(b);
}
}

/*
Output:
0x00000004
False
*/

但是,它做了什么?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com