AFCollectionList(T).Insert Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Inserts an item into the collection at the specified index.
Namespace: OSIsoft.AF
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public void Insert( int index, T item )
Public Sub Insert ( index As Integer, item As T ) Dim instance As AFCollectionList Dim index As Integer Dim item As T instance.Insert(index, item)
public: void Insert( int index, T item )
member Insert : index : int * item : 'T -> unit
Parameters
- index
- Type: SystemInt32
The zero-based index at which item should be inserted. If -1, then item is added to the end of the collection. - item
- Type: T
The object to insert. The value cannot be .
Exceptions
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The index parameter value is not a valid index in the collection. |
| NotSupportedException | The collection is read-only or the collection is a fixed size. |
Remarks
The collection does not accept values and allows duplicate items.
If index is equal to Count or -1, then item is added to the end of the collection.
This method is an O(n) operation, where n is Count.