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());
时间: 2024-12-25 11:38:26