Wintellect.PowerCollections Namespace
Algorithms Class
GhostDoc Pro Sample Help File

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Replace Method

Changes the value associated with a given key. If the dictionary does not contain a key equal to the passed key, then an ArgumentException is thrown.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public void Replace(
	TKey key,
	TValue value
)
Public Sub Replace ( _
	key As TKey, _
	value As TValue _
)
public:
void Replace(
	TKey key, 
	TValue value
)

Parameters

key
Type: TKey
The new key.
value
Type: TValue
The new value to associated with that key.

Exceptions


ExceptionCondition
KeyNotFoundExceptionkey is not present in the dictionary

Remarks


Unlike adding or removing an element, changing the value associated with a key can be performed while an enumeration (foreach) on the the dictionary is in progress.

Equality between keys is determined by the comparison instance or delegate used to create the dictionary.

Replace takes time O(log N), where N is the number of entries in the dictionary.