K
Ken Durden
Any ideas on what the best way to do this is:
[Flags]
public enum EOptions
{
op1 = 0x01,
op2 = 0x02,
op3 = 0x04,
op4 = 0x08,
op5 = 0x10,
op6 = 0x20,
op7 = 0x40,
op8 = 0x80,
}
public void F()
{
EOptions e = EOptions.op1 | EOptions.op3 | EOptions.op7;
EOptions[] opArray = Magic( e );
opArray.Length == 3;
opArray.Contains( EOptions.op1 );
opArray.Contains( EOptions.op3 );
opArray.Contains( EOptions.op7 );
}
How should I write Magic, to work with any enumerated type? I think we
can assume that the enum values represent individual bits selected as
high or low, as it is a FLAGS enum.
Thx,
-ken
[Flags]
public enum EOptions
{
op1 = 0x01,
op2 = 0x02,
op3 = 0x04,
op4 = 0x08,
op5 = 0x10,
op6 = 0x20,
op7 = 0x40,
op8 = 0x80,
}
public void F()
{
EOptions e = EOptions.op1 | EOptions.op3 | EOptions.op7;
EOptions[] opArray = Magic( e );
opArray.Length == 3;
opArray.Contains( EOptions.op1 );
opArray.Contains( EOptions.op3 );
opArray.Contains( EOptions.op7 );
}
How should I write Magic, to work with any enumerated type? I think we
can assume that the enum values represent individual bits selected as
high or low, as it is a FLAGS enum.
Thx,
-ken