Reputation: 41
I have:
IEnumerable<ObservableCollection<PointCollection>> rings =
from graphic
in e.FeatureSet
select ((Polygon)e.FeatureSet.Features).Rings;
I want to extract all the PointCollection's from each graphic and consolidate them into a single ObservableCollection. Something like this:
ObservableCollection<PointCollection> allRings = ?;
Is there a better way to iterate this without doing a bunch of nested ForEach statements?
Upvotes: 4
Views: 404
Reputation: 102753
You could use SelectMany
:
var allRings = new ObservableCollection<PointCollection>(
rings.SelectMany(rings => rings)
);
Upvotes: 3