Banking.AU.Common.Converters.EnumConverter.EnumConverter C# (CSharp) Method

EnumConverter() public method

public EnumConverter ( Type enumType ) : System
enumType System.Type
return System
        public EnumConverter(Type enumType)
        {
            _lookup = new Dictionary<object,string>();
            foreach (var e in Enum.GetValues(enumType))
            {
                _lookup.Add(e, e.ToString());
                var attrs = enumType.GetField(e.ToString()).GetCustomAttributes(typeof(FileRepresentationAttribute), false);
                if (attrs.Length == 1)
                    _lookup[e] = ((FileRepresentationAttribute)attrs[0]).Representation;
            }
        }