Mono Class Library: System.Collections.ArrayList Overview | Members

System.Collections.ArrayList.AddRange Method

Adds the elements of the specified ICollection to the end of the current instance.

public virtual void AddRange (ICollection c)

Parameters

c
The ICollection whose elements are added to the end of the current instance.

Exceptions

TypeReason
ArgumentNullExceptionc is null.
NotSupportedExceptionThe current instance is read-only or has a fixed size.

Remarks

Operation
As described above.

If the ArrayList.Count of the current instance plus the size of the collection being added is greater than the ArrayList.Capacity of the current instance, the capacity of the current instance is either doubled or increased to the new ArrayList.Count, whichever is greater. The internal array is reallocated to accommodate the new elements and the existing elements are copied to the new array before the new elements are added.

Note: For the default implementation, if the current instance can accommodate the new elements without increasing the ArrayList.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 ArrayList.Count .

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0