linq里面似in的查詢


 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());

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM