CogoPointCollection COGOPointsCollection = civilAcitveDoc.CogoPoints;
var cogoCollection2 = COGOPointsCollection.Where( p =>
selectedPointGroup.ContainsPoint( ((CogoPoint)p.GetObject(OpenMode.ForRead)).PointNumber ));
为什么cogoCollection2成为IEnumerableCogoPointCollection类型而不仅仅是CogoPointCollection类型
答案 0 :(得分:0)
LINQ方法适用于枚举,并且始终会产生某种IEnumerable<T>
。
如果要转换回原始集合类型,则必须自己在代码中完成。例如,如果CogoPointCollection具有适当的构造函数,则可以执行以下操作:
CogoPointCollection COGOPointsCollection = civilAcitveDoc.CogoPoints;
var cogoCollection2 = new CogoPointCollection
(
COGOPointsCollection.Where
(
p => selectedPointGroup.ContainsPoint
(
((CogoPoint)p.GetObject(OpenMode.ForRead)).PointNumber
)
)
);