using System.ComponentModel; using System.Reflection; namespace Indotalent.ConfigBackEnd.Extensions; public static class EnumExtension { public static string GetDescription(this Enum value) { var field = value.GetType().GetField(value.ToString()); if (field == null) { return value.ToString(); } var attribute = field.GetCustomAttribute(); return attribute == null ? value.ToString() : attribute.Description; } }