c# - Will the result of a LINQ query always be guaranteed to be in the correct order? -
question: result of linq query guaranteed in correct order?
example:
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 }; var lownums = n in numbers n < 5 select n;
now, when walk through entries of query result, in same order input data numbers
ordered?
foreach (var x in lownums) { console.writeline(x); }
if can provide note on ordering in documentation, perfect.
- for linq objects: yep.
- for parallel linq: nope.
- for linq expression trees (ef, l2s, etc): nope.
Comments
Post a Comment