Вопрос

I would like to filter a linq Lookup based on its values:

the lookup:

ILookup<int, Article> lookup

here's what I've got so far which isn't working:

IList<int> cityIndexes = GetCityIndexesByNames(cities);    

lookup = lookup
                .Where(p => p.Any(x => cityIndexes.Contains((int)x.ArticleCity)))
                .SelectMany(l => l)
                .ToLookup(l => (int)l.ArticleParentIndex, l => l);

just to clarify: I want to get all the articles with a city index that is contained in the above city index list.

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top