public static string GetDescription(this FigureType figureType) { FieldInfo fi = figureType.GetType().GetField(figureType.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : figureType.ToString()); }