Does Distinct() preserve always take the first element in the list
c#, linq
Solution
The defined behavior of Enumerable.Distinct is that it will return an unordered collection (Documentation).
However the current implementation of Distinct in Linq to Objects will preserve order. This is not guaranteed for other LINQ providers though and the behavior should not be relied upon.
Problem
Would ``` int[] nums = { 2, 3, 3, 4, 2, 1, 6, 7, 10 }; var distinct = nums.Distinct(); ``` always return `2, 3, 4, 1, 6, 7, 10` in that order?