Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using EleWise.ELMA.Model.Metadata;
- namespace Impeltech.Bank.Extensions
- {
- public static class EnumExtencion
- {
- public static string DisplayName(this Enum value)
- {
- if (value == null) return string.Empty;
- var enumMetadata = MetadataLoader.LoadMetadata(value.GetType()) as EnumMetadata;
- if (enumMetadata == null || !enumMetadata.Values.Any()) return string.Empty;
- var val = enumMetadata.Values.FirstOrDefault(c => c.Name == value.ToString());
- return val != null ? val.DisplayName : string.Empty;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement