enum mycity
{
beijing,shanghai
}
枚举的遍历
foreach( mycity city in enum.getvalues( typeof( mycity ) ) )
{
}
字符串转枚举
mycity enumtype;
string strTypeB = "myTypeB";
enumtype = (mycity)Enum.Parse(typeof(mycity),strTypeB);
枚举转字符串
mycity enumtype = mycity.beijing;
string strTypeB = Enum.GetName(typeof(mycity ), enumtype);