C
cyshao
Hi ,my friends:
I have a enum type ,EMyEnum , defigned as [Flag()].
I just want to do something like this:
foreach( EMyEnum crrEnum in EMyEnum )
{
//do something
}
////////////////////////////////////////////////////
But I can't find any way to do that, and only used a very foolish method
like this
string[] names = Enum.GetNames(typeof(EMyEnum ));
foreach (string crrEnumName in names )
{
EMyEnum crrEnum = (EMyEnum )Enum.Parse( typeof(EMyEnum ) ,
crrEnumName );
//do something
}
///////////////////////////////////////////////////
Are there any good ideas to do that?
Or Microsoft forget to design a method like this:
vector< EMyEnum > Enum.GetTypes( typeof(EMyEnum ) )
Thanks
CYShao ^_^
I have a enum type ,EMyEnum , defigned as [Flag()].
I just want to do something like this:
foreach( EMyEnum crrEnum in EMyEnum )
{
//do something
}
////////////////////////////////////////////////////
But I can't find any way to do that, and only used a very foolish method
like this
string[] names = Enum.GetNames(typeof(EMyEnum ));
foreach (string crrEnumName in names )
{
EMyEnum crrEnum = (EMyEnum )Enum.Parse( typeof(EMyEnum ) ,
crrEnumName );
//do something
}
///////////////////////////////////////////////////
Are there any good ideas to do that?
Or Microsoft forget to design a method like this:
vector< EMyEnum > Enum.GetTypes( typeof(EMyEnum ) )
Thanks
CYShao ^_^