Laxley Grandfather Clock puzzle artwork done.
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using BriarQueen.Data.Attributes;
|
||||
|
||||
namespace BriarQueen.Framework.Extensions
|
||||
{
|
||||
public class EnumExtensions
|
||||
public static class EnumExtensions
|
||||
{
|
||||
|
||||
public static string GetDisplayName(this Enum value)
|
||||
{
|
||||
var type = value.GetType();
|
||||
var field = type.GetField(value.ToString());
|
||||
|
||||
if (field == null)
|
||||
return value.ToString();
|
||||
|
||||
var attribute = field.GetCustomAttribute<DisplayNameAttribute>();
|
||||
|
||||
return attribute != null ? attribute.Name : value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user