[This is preliminary documentation and is subject to change.]
Called before item is placed into collection
Namespace: Tools.CollectionsT.GenericTAssembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
void OnAdding( ICollection Collection, Nullable<int> index, bool Replace ) |
| Visual Basic |
|---|
Sub OnAdding ( _ Collection As ICollection, _ index As Nullable(Of Integer), _ Replace As Boolean _ ) |
| Visual C++ |
|---|
void OnAdding( ICollection^ Collection, Nullable<int> index, bool Replace ) |
| F# |
|---|
abstract OnAdding : Collection:ICollection * index:Nullable<int> * Replace:bool -> unit |
| JScript |
|---|
function OnAdding( Collection : ICollection, index : Nullable<int>, Replace : boolean ) |
Parameters
- Collection
- Type: System.Collections..::..ICollection
Collection item is aboutto be placed into
- index
- Type: System..::..Nullable<(Of <(<'Int32>)>)>
Index item is being to be placed onto; null when collection does not support indexing.
- Replace
- Type: System..::..Boolean
True when item at index index will be replaced by this instance; false if this instance will be inserted at index and all subsequent items will be moved to nex index.
Remarks
To cancel adding, throw exception. Collection does not call this method when it does not allow cancellation of adding.
Call to OnAdding(ICollection, Nullable<(Of <<'(Int32>)>>), Boolean) does not necesarilly mena that OnAdded(ICollection, Nullable<(Of <<'(Int32>)>>)) will be called, because event can be canceled.
Exceptions
| Exception | Condition |
|---|---|
| System..::..Exception | Any axception may be thrown to cancel the operation. Exception is passed by collection to caller. |