Skip to content

Commit

Permalink
Add Enum.GetDescription extension method.
Browse files Browse the repository at this point in the history
  • Loading branch information
light-traveller committed Mar 17, 2023
1 parent 7d9b2f7 commit 1fde66a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/LightTraveller.Helpers/EnumExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ public static class EnumExtensions
{
return e.GetAttribute<DisplayAttribute>()?.Name;
}

public static string? GetDescription(this Enum e)
{
return e.GetAttribute<DisplayAttribute>()?.Description;
}
}

0 comments on commit 1fde66a

Please sign in to comment.