In C# if I want to see if a variable is equal to one of a set of fixed values, I currently do this...
bool result = ( (x==MyEnum.A) || (x==MyEnum.B) || (x==42) );
...which to me is cumbersome. Is there anything similar to this pseudo-code?
bool result = x in {MyEnum.A, MyEnum.B, 42};
我知道,我可以建立一个具有价值观的阵列,然后使用准则,但是否有任何其他选择?