Adds the elements of the specified collection to the end of the list.
- collection
- The collection whose elements are added to the end of the list.
Type Reason ArgumentNullException collection is null.
List<T> accepts null as a valid value for reference types and allows duplicate elements.
The order of the elements in the collection is preserved in the List<T>.
If the new List<T>.Count (the current List<T>.Count plus the size of the collection) will be greater than List<T>.Capacity, the capacity of the list is increased.
If the list can accommodate the new elements without increasing List<T>.Capacity, this method is an O(n) operation, where n is the number of elements to be added. If the capacity needs to be increased to accommodate the new elements, this method becomes an O(n + m) operation, where n is the number of elements to be added and m is List<T>.Count.
Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0