Append
Returns a new collection that contains the elements of the first collection followed by elements of the second.
Parameters | Returns |
---|---|
IEnumerable<T> source1
IEnumerable<T> source2 |
IEnumerable<T> |
Usage
A new collection is created by join all elements of both collections.
Appending second collection to the first one
//IEnumerable<int> first = { 1, 2, 3, 4, 5 }
//IEnumerable<int> second = { 6, 7, 8, 9, 10 }
IEnumerable<int> result = first.Append(second)
//result = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
//IEnumerable<int> first = { 6, 7, 8, 9, 10 }
//IEnumerable<int> second = { 1, 2, 3, 4, 5 }
IEnumerable<int> result = first.Append(second)
//result = { 6, 7, 8, 9, 10, 1, 2, 3, 4, 5 }