“值”的范围是0到15(可能的值)。何时满足这四个“如果”条件?如果我的(int)值= 2,这表示0010吗?
if ((int)value & 0x1)
{
//statement here
}
if ((int)value & 0x2)
{
//statement here
}
if ((int)value & 0x4)
{
//statement here
}
if ((int)value & 0x8)
{
//statement here
}
Enum.HasFlag方法测试位。请参阅:Enum.HasFlag。

value(读if(value & 0x4)为“是valueset 的第3位(= 1))。由于您似乎在理解代码时遇到问题,因此我认为它不是您的。(以及您没有询问的事实审查),使这个问题题外话CR.SE。