Click or drag to resize

RankedDictionaryTKey, TValueTryGetValueAndIndex Method

Gets the value and index associated with the supplied key.

Namespace:  Kaos.Collections
Assembly:  KaosCollections (in KaosCollections.dll) Version: 4.2.0.0
Syntax
C#
public bool TryGetValueAndIndex(
	TKey key,
	out TValue value,
	out int index
)

Parameters

key
Type: TKey
The key of the value and index to get.
value
Type: TValue
If key is found, its value is placed here; otherwise it will hold the default value.
index
Type: SystemInt32
If key is found, its index is placed here; otherwise it will hold a negative value.

Return Value

Type: Boolean
true if key is found; otherwise false.
Remarks

If key is not found, apply the bitwise complement operator (~) to index to get the index of the next higher item.

This is a O(log n) operation.

See Also