The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Collection<T>::Insert Method (Int32, T)
.NET Framework (current version)
Inserts an element into the Collection<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 null for reference types.
Implements
IList<T>::Insert(Int32, T)| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException |
Collection<T> accepts null 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 Inheritors:
Derived classes can override InsertItem to change the behavior of this method.
Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Available since 8
.NET Framework
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Show: