[This is preliminary documentation and is subject to change.]
Inserts an item to the ListWithEvents<(Of <(<'T>)>)> at the specified index.
Namespace: Tools.CollectionsT.GenericTAssembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
public virtual void Insert( int index, T item ) |
| Visual Basic |
|---|
Public Overridable Sub Insert ( _ index As Integer, _ item As T _ ) |
| Visual C++ |
|---|
public: virtual void Insert( int index, T item ) |
| F# |
|---|
abstract Insert : index:int * item:'T -> unit override Insert : index:int * item:'T -> unit |
| JScript |
|---|
public function Insert( index : int, item : T ) |
Parameters
- index
- Type: System..::..Int32
The zero-based index at which item should be inserted.
- item
- Type: T
The object to insert into the ListWithEvents<(Of <(<'T>)>)>.
Implements
IList<(Of <(<'T>)>)>..::..Insert(Int32, T)
Remarks
Note for inheritors: Call OnAdding(ListWithEvents<(Of <<'(T>)>>)..::..CancelableItemIndexEventArgs) before adding an item to the list and OnAdded(ListWithEvents<(Of <<'(T>)>>)..::..ItemIndexEventArgs) after adding item to the list, do not forgot to check Cancel
Exceptions
| Exception | Condition |
|---|---|
| System..::..ArgumentOutOfRangeException | index is not a valid index in the ListWithEvents<(Of <(<'T>)>)>. |
| System..::..InvalidOperationException | Locked is True |
| System..::..OperationCanceledException | Operation is canceled in eventhandler and CancelError is true |
| System..::..Exception | Any Exception can be thrown by event handler of the Adding event -or- Any excption may be thrown by OnAdding(ICollection, Nullable<(Of <<'(Int32>)>>), Boolean) when AllowItemCancel is true. |