Example #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;
            }
        }
Example #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;
 }