码迷,mamicode.com
首页 > 其他好文 > 详细

linq里面似in的查询

时间:2016-05-10 02:04:05      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

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

linq里面似in的查询

标签:

原文地址:http://www.cnblogs.com/Alex80/p/5476084.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!