Assume two lists, A and B so that A = (1,2,3) and B = (4,5,6). Will A.Concat(B) preserve the order so that the result is (1,2,3,4,5,6)?
Ordering in SQL is the final step before results are produced. For this reason, the Concat operator is implemented by using UNION ALL and does not preserve the order of its arguments.
The simple answer is no, ToList will just loop over the source enumerable and keep the same order.
Groupby preserves the order of rows within each group. When calling apply, add group keys to index to identify pieces. Reduce the dimensionality of the return type if possible, otherwise return a consistent type.
Found answer on MSDN: Yes.
Yes. IEnumerable.Concat will simply turn two list into a single list by attaching one to the end of the other. Order within each list will be preserved.
Yes, that's pretty much what concatenation means.
Obligatory MSDN quote: (Enumerable.Concat)
Return Value
Type: System.Collections.Generic.IEnumerable(TSource)
An IEnumerable(T) that contains the concatenated elements of the two input sequences.
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