public Cache(
IDictionary<TKey, TValue> dictionary,
IEqualityComparer<TKey>? comparer = null
)
Public Sub New (
dictionary As IDictionary(Of TKey, TValue),
Optional comparer As IEqualityComparer(Of TKey) = Nothing
)
public:
Cache(
IDictionary<TKey, TValue>^ dictionary,
IEqualityComparer<TKey>^ comparer = nullptr
)
new :
dictionary : IDictionary<'TKey, 'TValue> *
?comparer : IEqualityComparer<'TKey>
(* Defaults:
let _comparer = defaultArg comparer null
*)
-> Cache
Every key in a CacheTKey, TValue must be unique according to the specified comparer.
This constructor does not specify an item loader and initializes Capacity to the number of elements in the specified dictionary. Meaning, adding new elements manually will drop an element unless you increase Capacity, and reading the indexer with a non-existing key will throw a KeyNotFoundException.
This constructor sets EnsureCapacity to , so no multiple allocations occur during the initialization.