Click or drag to resize

RouletteDictionaryTKey, TValueGetRandomKeyAndValue Method (FuncTValue, 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: SystemFuncTValue, Boolean
A function to test elements for a condition.

Return Value

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