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

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

Inserts an item to the List at the specified position.

public void Insert (int index, T item)

Parameters

index
The zero-based index at which item is to be inserted.
item
The item to insert. (item can be null if T is a reference type.)

Exceptions

TypeReason
ArgumentOutOfRangeException

index is less than 0.

-or-

index is greater than stem.Collections.Generic.List<T>.Count.

Remarks

List<T> accepts null 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 index is equal to List<T>.Count, item is added to the end of list.

Requirements

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