btcpayserver/BTCPayServer/Extensions/EnumExtensions.cs

14 lines
361 B
C#
Raw Normal View History

using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
namespace BTCPayServer
{
public static class EnumExtensions
{
2021-12-31 08:59:02 +01:00
public static string DisplayName(this Type enumType, string input) =>
enumType.GetMember(input).First().GetCustomAttribute<DisplayAttribute>()?.Name ?? input;
}
}