This documentation is archived and is not being maintained.
Collection(T).Insert Method
Visual Studio 2010
Inserts an element into the Collection(T) at the specified index.
Assembly: mscorlib (in mscorlib.dll)
abstract Insert : index:int * item:'T -> unit override Insert : index:int * item:'T -> unit
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 a null reference (Nothing in Visual Basic) for reference types.
Implements
IList(T).Insert(Int32, T)| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | index is less than zero. -or- index is greater than Count. |
Collection(T) accepts a null reference (Nothing in Visual Basic) 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(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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: