Пример #1
0
        public override Dictionary <string, string> EnumOptions(object target, string paramName)
        {
            PropertyInfo pro  = target.GetType().GetProperty(paramName);
            string       flag = ConfigAttribute.GetFieldFlag(pro);

            if (flag != null)
            {
                string[] flags = flag.Split('.');
                if (flags.Length == 2)
                {
                    string   fullName = "conf." + flags[0];
                    string[] pros     = flags[1].Split('|');
                    string   vpro     = pros[0];
                    string   dpro     = pros[1];
                    Dictionary <string, string> enums = new Dictionary <string, string>();
                    IList list = GetConfigData(fullName) as IList;
                    {
                        for (int i = 0; i < list.Count; i++)
                        {
                            object obj = list[i];
                            string v   = obj.GetType().GetProperty(vpro).GetValue(obj, null).ToString();
                            string d   = obj.GetType().GetProperty(dpro).GetValue(obj, null).ToString();
                            enums.Add(v, d);
                        }
                    }
                    return(enums);
                }
            }
            return(null);
        }