我收集了IEnumerable<Person>
它包含:
还有一些收集,比如数组
Array CityList = {"Delhi","Goa",...}
Array CountryList = {"India","USA",...}
Array DistrictList = {"Acb","Xyz",...}
我想在
上应用过滤器attribute City, Country & District
of PersonCollection on the basic
of CityList, CountryList & DistrictList.
说我有一个过滤器
Array CityList = {"Delhi",}
Array CountryList = {"USA","UK"}
Array DistrictList = {null}
然后我需要这些记录的过滤结果
City = Delhi
OR
Country = USA
OR
Country = UK
获得所需结果的任何解决方案?
答案 0 :(得分:0)
PersonCollection.Where(p =>
CityList.Contains(p.City) ||
CountryList.Contains(p.Country) ||
DistrictList.Contains(p.District)
)