Frage

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.

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top