IListContract<T>.Insert(Int32, T) Method

Definition

Inserts an item at the specified index in an IListContract<T> collection.

public:
 void Insert(int index, T item);
public void Insert (int index, T item);
abstract member Insert : int * 'T -> unit
Public Sub Insert (index As Integer, item As T)

Parameters

index
Int32

The zero-based index at which to insert item.

item
T

The IContract object to insert in the IListContract<T> collection.

Exceptions

index is less than zero.

-or-

index is equal to or greater than the return value of GetCount().

The IListContract<T> collection is read-only.

Remarks

After you call the Insert method, the items that follow the insertion point move to accommodate the new item. The indexes of the items that are moved are also updated. To replace an item at a specified index, use the SetItem method.

To determine whether an IListContract<T> collection is read-only, call the GetIsReadOnly method.

Applies to