Пример #1
0
        private EnumProxy(object v)
        {
            this.realValue = v;
            System.Type t  = v.GetType();
            FieldInfo   fi = t.GetField(v.ToString());

            object[] attr = fi.GetCustomAttributes(typeof(EnumTitleAttribute), false);
            if (null == attr || attr.Length == 0)
            {
                this.attribute = new EnumTitleAttribute(v.ToString());
            }
            else
            {
                this.attribute = attr[0] as EnumTitleAttribute;
            }
        }
Пример #2
0
 private EnumProxy(object v)
 {
     this.realValue = v;
     System.Type t = v.GetType();
     FieldInfo fi = t.GetField(v.ToString());
     object[] attr = fi.GetCustomAttributes(typeof(EnumTitleAttribute), false);
     if (null == attr || attr.Length == 0)
         this.attribute = new EnumTitleAttribute(v.ToString());
     else
         this.attribute = attr[0] as EnumTitleAttribute;
 }