Esempio n. 1
0
        public static string GetDescription <TEnum>(TEnum enumValue)
        {
            Type            t    = enumValue.GetType();
            SymbolAttribute attr = t.GetField(Enum.GetName(t, enumValue)).GetCustomAttributes(typeof(SymbolAttribute), false).OfType <SymbolAttribute>().FirstOrDefault();

            return((attr == null) ? null : attr.Description);
        }
Esempio n. 2
0
        public static string GetSymbol <TEnum>(TEnum enumValue)
            where TEnum : struct, IComparable, IFormattable, IConvertible
        {
            Type            t    = enumValue.GetType();
            SymbolAttribute attr = t.GetField(Enum.GetName(t, enumValue)).GetCustomAttributes(typeof(SymbolAttribute), false).OfType <SymbolAttribute>().FirstOrDefault();

            return((attr == null) ? null : attr.Symbol);
        }