Jon Skeet [C# MVP] wrote:
Todd Beaulieu <To**********@discussions.microsoft.comwrote:
Hello, I have a list of elements and I want to perform an operation
on a subset of them and then remove them from the list.
If I build a sequence of elements via LINQ to drive the
enumeration, as soon as I remove the first element the enumeration
operation is broken.
This surprises me. I thought the LINQ'd sequence would be its own
collection, impervious to changes in the original source collection.
No - LINQ streams the data (when it can), so it will still be asking
the original data source for data as it goes.
Only outside a db. Any linq-access to a db isn't streamed but batched
(i.e.: fetch everything to the client)
FB
--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website:
http://www.llblgen.com
My .NET blog:
http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------