Collection(Of T).Insert Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Inserts an element into the Collection(Of T) at the specified index.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- index
- Type: System.Int32
The zero-based index at which item should be inserted.
- item
- Type: T
The object to insert. The value can be Nothing for reference types.
Implements
IList(Of T).Insert(Int32, T)| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | index is less than zero. -or- index is greater than Count. |
Collection(Of T) accepts Nothing as a valid value for reference types and allows duplicate elements.
If index is equal to Count, item is added to the end of Collection(Of T).
This method is an O(n) operation, where n is Count.
Notes to InheritorsDerived classes can override InsertItem to change the behavior of this method.