枚举的遍历和字符串转枚举,枚举转字符串 转
enum Score
{
EE,EX,BE,ME,PME
}
枚举的遍历
foreach( Scorecity in enum.getvalues( typeof( Score) ) )
{
}
字符串转枚举
Score enumtype;
string strTypeB = "EE";
enumtype = (Score)Enum.Parse(typeof(Score),strTypeB);
枚举转字符串
myScore enumtype = Score.EE;
string strTypeB = Enum.GetName(typeof(myScore ), enumtype);