UI rendberakása
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -17,6 +19,15 @@ namespace WorkFlowCheck.Common.Helper
|
||||
|
||||
return displayNameAttribute?.DisplayName ?? propertyName;
|
||||
}
|
||||
public static string GetEnumDisplayName(this Enum enumValue)
|
||||
{
|
||||
return enumValue
|
||||
.GetType()
|
||||
.GetMember(enumValue.ToString())
|
||||
.First()
|
||||
.GetCustomAttribute<DisplayAttribute>()?
|
||||
.Name ?? enumValue.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user