mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-19 00:51:30 -07:00
15 lines
371 B
C#
15 lines
371 B
C#
using System.ComponentModel;
|
|
using System.Reflection;
|
|
|
|
namespace Bloxstrap.Extensions
|
|
{
|
|
internal static class TEnumEx
|
|
{
|
|
public static string? GetDescription<TEnum>(this TEnum e)
|
|
{
|
|
DescriptionAttribute? attribute = e?.GetType().GetCustomAttribute<DescriptionAttribute>();
|
|
return attribute?.Description;
|
|
}
|
|
}
|
|
}
|