public static string GetDescription(this ClusterRole source) { string description; try { FieldInfo fi = source.GetType().GetField(source.ToString()); var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false); if (attributes.Length > 0) { return(attributes[0].Description); } description = source.ToString(); } catch (Exception) { return(""); } return(description); }