Click or drag to resize

RankedDictionaryTKey, TValueTryGetValue Method

Gets the value associated with the supplied key.

Namespace:  Kaos.Collections
Assembly:  KaosCollections (in KaosCollections.dll) Version: 4.2.0.0
Syntax
Exceptions
ExceptionCondition
ArgumentNullExceptionWhen key is null.
Remarks
This is a O(log n) operation.
Examples
The below snippet is part of a larger example of the RankedDictionaryTKey, TValueclass.
C#
// When a program often has to try keys that are usually not in the
// dictionary, TryGetValue can be a more efficient way to get values.
if (cc.TryGetValue ("ZZ", out string value))
    Console.WriteLine ($"For key = 'ZZ', value = {value}.");
else
    Console.WriteLine ("Key = 'ZZ' is not found.");
See Also