using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace IMCS_CCS.Utils { public class EnumHelper { public static string GetDescription(Enum value) { if (value == null) { throw new ArgumentException("value"); } string description = value.ToString(); var fieldInfo = value.GetType().GetField(description); var attributes = (EnumDescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(EnumDescriptionAttribute), false); if (attributes != null && attributes.Length > 0) { description = attributes[0].Description; } return description; } } }