I use LINQ to Objects instructions on an ordered array.
Which operations shouldn't I do to be sure the order of the array is not changed?
C# – Preserving order with LINQ
arrayscdata structureslinqsorting
Related Topic
- Ios – How to sort an NSMutableArray with custom objects in it
- Javascript – Sorting an array of objects by property values
- Php – How to Sort a Multi-dimensional Array by Value
- Javascript – Loop through an array in JavaScript
- C# – IEnumerable vs List – What to Use? How do they work
- C# – Use LINQ to get items in one List<>, that are not in another List<>
- Javascript – How to remove a specific item from an array
- C# – Group by in LINQ
Best Answer
I examined the methods of System.Linq.Enumerable, discarding any that returned non-IEnumerable results. I checked the remarks of each to determine how the order of the result would differ from order of the source.
Preserves Order Absolutely. You can map a source element by index to a result element
Preserves Order. Elements are filtered or added, but not re-ordered.
Destroys Order - we don't know what order to expect results in.
Redefines Order Explicitly - use these to change the order of the result
Redefines Order according to some rules.
Edit: I've moved Distinct to Preserving order based on this implementation.