SystemEnum的方法-C#经典教程
System.Enum的方法 using System; namespace App1 { class myApp { enum Fabric { Cotton = 1, Silk = 2 } static void Main() { string fabStr = "Cotton"; if (Enum.IsDefined(typeof(Fabric), fabStr)) { Fabric fab = (Fabric)Enum.Parse(typeof(Fabric), fabStr); Console.WriteLine(Enum.GetName(typeof(Fabric), 2)); } } } }