Files
moadiran/Shared/ExMethod.cs

22 lines
527 B
C#
Raw Normal View History

2024-05-14 14:58:25 +03:30
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace Shared
{
public static class ExMethod
{
public static string GetEnumDisplayName(this Enum enumType)
{
return enumType.GetType().GetMember(enumType.ToString())
.First()
.GetCustomAttribute<DisplayAttribute>()
.Name;
}
}
}