[This is preliminary documentation and is subject to change.]
Adds an item to the DictionaryWithEvents<(Of <(<'TKey, TValue>)>)>.
Namespace: Tools.CollectionsT.GenericTAssembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
public virtual void Add( TKey key, TValue value ) |
| Visual Basic |
|---|
Public Overridable Sub Add ( _ key As TKey, _ value As TValue _ ) |
| Visual C++ |
|---|
public: virtual void Add( TKey key, TValue value ) |
| F# |
|---|
abstract Add : key:'TKey * value:'TValue -> unit override Add : key:'TKey * value:'TValue -> unit |
| JScript |
|---|
public function Add( key : TKey, value : TValue ) |
Parameters
- key
- Type: TKey
Key of object being added
- value
- Type: TValue
The object to add to the DictionaryWithEvents<(Of <(<'TKey, TValue>)>)>.
Implements
IDictionary<(Of <(<'TKey, TValue>)>)>..::..Add(TKey, TValue)
Remarks
Note for inheritors: Call OnAdding(DictionaryWithEvents<(Of <<'(TKey, TValue>)>>)..::..CancelableKeyValueEventArgs) before adding an item to the list and OnAdded(DictionaryWithEvents<(Of <<'(TKey, TValue>)>>)..::..KeyValueEventArgs) after adding item to the list, do not forgot to check Cancel
Exceptions
| Exception | Condition |
|---|---|
| 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 |
| System..::..ArgumentNullException | key is null |
| System..::..ArgumentException | An element with the same key already exists in the DictionaryWithEvents<(Of <(<'TKey, TValue>)>)>. |