이것은 나를 위해 일한 후 실패했습니다. 모든 필터가 포함 된 항목 만 반환하고 하나 이상의 필터는 현재하고 싶지 않습니다. 여기서 뭐가 틀렸어? - 기본적으로 AND
다른 모음의 내용에서 항목 모음 필터링
foreach(string s in filters) {
if(s.Length == 0) continue;
string tmp = s; // because of "capture" problem
index = index.Where(i => i.FilterNames.Contains(tmp));
}
return index;
이 모든 필터를 덮고, Where
조항의 연속을 적용 같은 것에 대해 어떻게
private IQueryable<IndexItem> FilteredIndex (IQueryable<IndexItem> index, IEnumerable<string> filters)
{
var filteredIndex= from f in filters.AsQueryable()
where f.Length>0
from i in index
where i.FilterNames.Contains(f)
select i;
return filteredIndex;
}
어떤 LINQ 공급자를 사용하고 있습니까? IQueryable을 사용하여 LINQ to Objects가 아닌 것으로 가정합니다. –
LINQ for Objects에 대해 꽤 우아한 솔루션을 제공 할 수 있지만 실제로 작동하는지 여부는 확실하지 않습니다. 만약 그렇다면 나에게 들려줘. –