This commit is contained in:
younes elhaddoury
2025-09-17 10:28:02 +02:00
parent 9c8fb9b205
commit bb13759af4
288 changed files with 102393 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
namespace LEA.Extensions;
public static class EnumExtensions
{
public static string GetDisplayName(this Enum value)
{
var memberInfo = value.GetType().GetMember(value.ToString()).FirstOrDefault();
var displayAttribute = memberInfo?.GetCustomAttribute<DisplayAttribute>();
return displayAttribute?.GetName() ?? value.ToString();
}
}