| Visual Basic (Declaration) | |
|---|---|
Public Overrides Sub Insert( _ ByVal index As Integer, _ ByVal value As Object _ ) | |
| Visual Basic (Usage) | Copy Code |
|---|---|
Dim instance As MailboxCollection Dim index As Integer Dim value As Object instance.Insert(index, value) | |
Parameters
- index
- The zero-based index at which value should be inserted.
- value
- The Object to insert.
| Exception | Description |
|---|---|
| System.ArgumentOutOfRangeException | index is less than zero. -or-index is greater than Count. |
| System.NotSupportedException | The ArrayList is read-only. -or-The ArrayList has a fixed size. |
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.
In collections of contiguous elements, such as lists, the elements that follow the insertion point move down to accommodate the new element. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hashtable.
Target Platforms: Microsoft .NET Framework 2.0