Files

21 lines
605 B
C#
Raw Permalink Normal View History

2026-01-01 22:40:32 +08:00
using System.ComponentModel;
using System.Reflection;
namespace SHH.CameraDashboard
{
public static class EnumHelper
{
public static string GetDescription(Enum value)
{
FieldInfo fi = value.GetType().GetField(value.ToString());
DescriptionAttribute[] attributes =
(DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attributes != null && attributes.Length > 0)
return attributes[0].Description;
else
return value.ToString();
}
}
}