Inserts an element into the ArrayList at the specified index.
[Visual Basic] Overridable Public Sub Insert( _ ByVal index As Integer, _ ByVal value As Object _ ) [C#] public virtual void Insert( int index, object value ); [C++] public: virtual void Insert( int index, Object* value ); [JScript] public function Insert( index : int, value : Object );
None.
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | index is less than zero.
-or- index is equal to or greater than Count. |
NotSupportedException | The ArrayList is read-only.
-or- The ArrayList has a fixed size. |
This method can be overridden by a derived class.
If Count already equals Capacity, the capacity of the list is doubled by automatically reallocating the internal array, before the new element is inserted.
If index is equal to Count, value is added to the end of ArrayList.
ArrayList Class | ArrayList Members | System.Collections Namespace | Add | InsertRange