C# 从IEnumerableC中提取项目

C# 从IEnumerableC中提取项目,c#,linq,ienumerable,observablecollection,C#,Linq,Ienumerable,Observablecollection,我有: 我想从每个图形中提取所有PointCollection,并将它们合并到单个ObservableCollection中。大概是这样的: IEnumerable<ObservableCollection<PointCollection>> rings = from graphic in e.FeatureSet select ((Polygon)e.FeatureSet.Features).Rings; 有没有更好的方法可以在不使用一堆

我有:

我想从每个图形中提取所有PointCollection,并将它们合并到单个ObservableCollection中。大概是这样的:

IEnumerable<ObservableCollection<PointCollection>> rings = 
    from graphic 
    in e.FeatureSet 
    select ((Polygon)e.FeatureSet.Features).Rings;
有没有更好的方法可以在不使用一堆嵌套的ForEach语句的情况下进行迭代?

您可以使用:

ObservableCollection<PointCollection> allRings = ?;
var allRings = new ObservableCollection<PointCollection>(
    rings.SelectMany(rings => rings)
);