Mono Class Library: System.Collections.Generic.List<T> Overview | Members

System.Collections.Generic.List<T>.Add Method

Adds an item to the end of the list.

public void Add (T item)

Parameters

item
The item to add to the end of the list. (item can be null if T is a reference type.)

Remarks

List<T> accepts . as a valid value for reference types and allows duplicate elements.

If List<T>.Count already equals List<T>.Capacity, the capacity of the list is increased.

If List<T>.Count is less than List<T>.Capacity, this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(n) operation, where n is List<T>.Count.

Requirements

Namespace: System.Collections.Generic
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0