我有一个有 3 种枚举类型的类
我想要一个可以将所有 3 个枚举作为参数并获取枚举的整数值的方法。
public enum Enum1
{
Fire = 0,
Hour_24 = 1,
Key_Switch = 2,
Follower = 3,
Entry_Delay1 = 4,
Entry_Delay2 = 5,
Intertior = 6,
Local_Only = 7,
}
public enum Enum2
{
Faulted = 0,
Tampered = 1,
Trouble = 2,
Bypassed = 3,
Inhibited = 4,
Low_Battery = 5,
Loss_Supervision = 6,
Reserved,
Alarm_Memory = 8,
Bypass_Memory = 9
}
private void BuildMessage ()
{
List<Enum1> Enum1List = new List<Enum1>();
FillBits(Enum1List); // => Here I get an error.
}
// This method should accept Enum1 and Enum2
private Byte[] FillBits(List<Enum> EnumList)
{
foreach (Enum e in EnumList)
{
int value = Convert.ToInt32(e);
}
}
我怎样才能做到这一点?
谢谢