/// <summary>擴充功能</summary>public static class CHelpExtensions{/// <summary>/// 取得列舉定義的字串/// </summary>/// <param name="value">列舉</param>public static string GetDescription(this Enum value){FieldInfo fi = value.GetType().GetField(value.ToString());DescriptionAttribute[] attributes = fi.GetCustomAttributes(typeof(DescriptionAttribute), false) as DescriptionAttribute[];//若取不到屬性,則取名稱return attributes.Length > 0 ? attributes[0].Description : value.ToString();}}