Click or drag to resize

RouletteDictionary<TKey, TValue>.GetRandomKeyAndValue Method (Func<TValue, Boolean>)

Gets a random key-value pair from the dictionary whose value satisfies a condition.

Namespace:  Scaleout.Collections
Assembly:  Scaleout.Collections (in Scaleout.Collections.dll) Version: 1.0.3.0 (1.0.3.0)
Syntax
C#
public KeyValuePair<TKey, TValue> GetRandomKeyAndValue(
	Func<TValue, bool> predicate
)

Parameters

predicate
Type: System.Func<TValue, Boolean>
A function to test elements for a condition.

Return Value

Type: KeyValuePair<TKey, TValue>
A random key-value pair from the dictionary.
Exceptions
ExceptionCondition
InvalidOperationException The dictionary is empty or no entries satisfy the predicate.
See Also