布尔表达式我有几个值的简单枚举涉及枚举和Int
Enum Status{
Available,
Taken,
Sold//and many more
}
我要检查其状态是否在可能的值(假设值写入这样的次序之间的某处最低的是一个进程的开始,而最后的是过程的最后步骤)
喜欢的东西
Status s1;//Some value
if(s1<5 && s1>3)
//The value is one of the enum values in those range
//(for example the job has already been accepted, but has still not been
//shipped)
这可能吗?
感谢。
只需将状态转换为int并执行检查:(int)s1 – bcl
有人删除此问题,我无法弄清楚如何正确搜索它。 – master2080
您可以自己删除它。编辑旁边有一个按钮。我们不会为你做。 –