什么是运营商`| =`?我如何在C#中实现这一点? [英] What is the operator `|=`? How can I implement this in C#?
本文介绍了什么是运营商`| =`?我如何在C#中实现这一点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是做下面的C ++代码?更具体地讲,什么是经营者 | =
What is the C++ code below doing? More specifically, what is the operator |=
?
long liFaultFlags = 0;
for (int i = 0; i < FAULTCOUNT; i++)
{
if (faults[i] == true)
{
liFaultFlags |= (1 << i);
}
}
return liFaultFlags;
这将如何在C#中实现?
How would this be implemented in C#?
推荐答案
这是位或运算符以及相当于到
liFaultFlags = liFaultFlags | (1<<i);
您会写在正好在C#中同样的方式,行。
You would write that line in exactly the same way in C#.
这篇关于什么是运营商`| =`?我如何在C#中实现这一点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文