我有这样一个枚举:
#region -酒的种类-
public enum WineType
{
白酒 = 3,
葡萄酒 = 4,
洋酒 = 5,
陈年老酒 = 16,
啤酒 = 17
}
#endregion
怎么实现我输入
白酒
然后得到白酒在枚举WineType
中对应的值3
呢?
白酒 = 3
WineType flag;
if (Enum.TryParse<WineType>("白酒", true, out flag))
{
Console.Write("ok");
//值
Console.Write((int)flag);
}
...怎么又发个