Extracting elements from IEnumerable <ObservableCollection <T>> C #
I have:
IEnumerable<ObservableCollection<PointCollection>> rings = from graphic in e.FeatureSet select ((Polygon)e.FeatureSet.Features).Rings; I want to extract all PointCollection from each graphic and combine them into one ObservableCollection. Something like that:
ObservableCollection<PointCollection> allRings = ?; Is there a better way to repeat this without doing a bunch of nested ForEach statements?
+4
1 answer
You can use SelectMany :
var allRings = new ObservableCollection<PointCollection>( rings.SelectMany(rings => rings) ); +3