[Solved] why “where” changing the original data type


LINQ methods work on enumerations, and always yield an IEnumerable<T> of some kind.

If you want to convert back to the original collection type, you’d have to do that yourself in code. If CogoPointCollection has an appropriate constructor, for example, you could do this:

CogoPointCollection COGOPointsCollection = civilAcitveDoc.CogoPoints;

var cogoCollection2 = new CogoPointCollection
(
    COGOPointsCollection.Where
    (
        p => selectedPointGroup.ContainsPoint
        ( 
            ((CogoPoint)p.GetObject(OpenMode.ForRead)).PointNumber 
        )
    )
);

2

solved why “where” changing the original data type