Click or drag to resize

ConcurrentTokenizedPriorityQueueTKey, TValue, TTokenEnqueueOrUpdate(KeyValuePairTKey, TValue, TToken, FuncTToken, KeyValuePairTKey, TValue, KeyValuePairTKey, TValue) Method

Adds a key/value pair associated with a token to the queue (if no such token is already present), or updates the already present key/value pair associated with the provided token.

Namespace: Altaxo.Collections
Assembly: AltaxoCore (in AltaxoCore.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public KeyValuePair<TKey, TValue> EnqueueOrUpdate(
	KeyValuePair<TKey, TValue> addValue,
	ref TToken token,
	Func<TToken, KeyValuePair<TKey, TValue>, KeyValuePair<TKey, TValue>> updateFactory
)

Parameters

addValue  KeyValuePairTKey, TValue
The key/value pair that should be enqueued if the provided token is not present in the queue.
token  TToken
The token. On return, if the token was not in the queue, contains a new token that was freshly generated.
updateFactory  FuncTToken, KeyValuePairTKey, TValue, KeyValuePairTKey, TValue
A function that generates a new key/value pair that should be used to update the key/value pair associated with the provided token if it is already present in the queue.

Return Value

KeyValuePairTKey, TValue
The key/value pair that was used. Either the addValue, or the key/value pair used for update.
Exceptions
ExceptionCondition
InvalidOperationExceptionThis queue is generating tokens by itself. Use Enqueue(key, value) instead!
See Also