Question: Will the result of a LINQ query always be guaranteed to be in the correct order?
Example:
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
var lowNums =
from n in numbers
where n < 5
select n;
Now, when we walk through the entries of the query result, will it be in the same order as the input data numbers
is ordered?
foreach (var x in lowNums)
{
Console.WriteLine(x);
}
If someone can provide a note on the ordering in the documentation, this would be perfect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With