Beispiel #1
0
        /// <summary>
        /// 执行当前的筛选函数
        /// </summary>
        public IEnumerable <T> Query <T>(IEnumerable <T> p_Object, _Element p_elements)
        {
            var list = from p in p_Object.Cast <T>()
                       select p;

            list = list.Where(c => this.doWhere <T>(c, c.GetType().GetProperty(p_elements.key).PropertyType, p_elements));

            return(list.ToList <T>());
        }
Beispiel #2
0
 private bool doWhere <T>(T obj, Type t, _Element e)
 {
     switch (t.Name)
     {
     case "String":
         return(obj.GetType().GetProperty(e.key).GetValue(obj, null).ToString() == e.value.ToString());
     }
     return(false);
 }