I have a question on Union
and Concat
. I guess both are behaving same in case of List
.
var a1 = (new[] { 1,
Concat
literally returns the items from the first sequence followed by the items from the second sequence. If you use Concat
on two 2-item sequences, you will always get a 4-item sequence.
Union
is essentially Concat
followed by Distinct
.
In your first two cases, you end up with 2-item sequences because, between them, each pair of input squences has exactly two distinct items.
In your third case, you end up with a 4-item sequence because all four items in your two input sequences are distinct.