1
General Discussion / Re: Questions Not Worth Their Own Thread: C# Edition
« Last post by Steve Walmsley on Today at 06:23:19 PM »Huh. It may be that C# works differently than I expected, but the docs don’t indicate that the OrderBy method modifies the underlying list.
It's not the OrderBy, it is the Except that precedes it.
The documentation for Except doesn’t say that it modifies the list either. It is my understanding that none of the Enumerable methods modify the underlying data.
I don't want to turn this thread into a programming debate, which is one of the reasons that I rarely post code
Are you suggesting that instead of a new list, I use the LINQ without assigning to a new list as the target in the foreach loop?
If so, I prefer to avoid that. It's harder to read and harder to debug and those are more important to me than straight performance.
If not, maybe DM me with an example of the code as you would write it.