Table of Contents

Class ReadOnlyDictionaryMap<K, V>

Namespace
Utils.Collections
Assembly
Utils.dll

Default implementation of IReadOnlyDictionaryMap<K, V> that relies on delegate accessors.

public class ReadOnlyDictionaryMap<K, V> : IReadOnlyDictionaryMap<K, V>

Type Parameters

K

Type of the keys used by the dictionary.

V

Type of the values stored in the dictionary.

Inheritance
ReadOnlyDictionaryMap<K, V>
Implements
Derived
Inherited Members
Extension Methods

Constructors

ReadOnlyDictionaryMap(Func<K, V>, Func<IEnumerable<KeyValuePair<K, V>>>, Func<int>)

Initializes a new instance of the ReadOnlyDictionaryMap<K, V> class using delegate-based accessors.

public ReadOnlyDictionaryMap(Func<K, V> getValue, Func<IEnumerable<KeyValuePair<K, V>>> getItems, Func<int> getCount)

Parameters

getValue Func<K, V>

Delegate that retrieves a value for a given key.

getItems Func<IEnumerable<KeyValuePair<K, V>>>

Delegate that returns all key/value pairs.

getCount Func<int>

Delegate that provides the item count when available.

Properties

CanCount

Gets a value indicating whether GetCount() can be called without enumerating the dictionary.

public bool CanCount { get; }

Property Value

bool

Methods

GetCount()

Retrieves the count of the key/value pairs when available.

public int GetCount()

Returns

int

GetValue(K)

Retrieves a value using the provided key.

public V GetValue(K key)

Parameters

key K

The key that identifies the value.

Returns

V

The value associated with key.

GetValues()

Returns the key/value pairs contained in the dictionary.

public IEnumerable<KeyValuePair<K, V>> GetValues()

Returns

IEnumerable<KeyValuePair<K, V>>