1.linq里面似in的查询  

List<string> source = new List<string>{ "aaa", "bbb" };        

List<string> px = new  List<string> { "aaa", "bbb", "ccc" }; 

 var q = from s in source   

        from p in px                  

         where s==p        

          select s;

2. 得到集合里面是  p.DState in (1, 100,200 )的集合

  List<int> pp = new  List<int> { 1, 100,200 };        

     if (queryString == "AllState")           

    {            

     DataSouce = new ObservableCollection<DocRegister>((from p in _returnList           

                  from ids in pp            

                 where p.DState == ids                

                select p).ToList());                 

   }

3.根据一个条件过滤数据集合queryString是条件

 DataSouce = new ObservableCollection<DocRegister>(_returnList.Where(p => p.DState == Convert.ToInt32(queryString)).ToList());

 

相关文章:

  • 2021-09-15
  • 2021-08-02
  • 2021-06-14
猜你喜欢
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案