Table of Contents

Struct ValueDictionary<TKey, TValue>.Builder.KeysEnumerator

Namespace
Badeend.ValueCollections
Assembly
Badeend.ValueCollections.dll

This type facilitates reading only the keys of a dictionary.

public struct ValueDictionary<TKey, TValue>.Builder.KeysEnumerator
Inherited Members

Remarks

This is a stack-allocated enumerator over the keys in the dictionary. Any KeysEnumerator is only valid unti the next mutation performed on the builder. After which, a new KeysEnumerator must be obtained.

To prevent accidental boxing, KeysEnumerator does not implement any interface. If you want to use the keys as a collection (e.g. IEnumerable<T>, IReadOnlyCollection<T>, etc.) you can still manually box it by calling AsCollection().

Properties

Current

Gets the element in the collection at the current position of the enumerator.

public readonly TKey Current { get; }

Property Value

TKey

Methods

AsCollection()

Create a new heap-allocated temporary view over the keys in the dictionary.

public readonly ValueDictionary<TKey, TValue>.Builder.KeysCollection AsCollection()

Returns

ValueDictionary<TKey, TValue>.Builder.KeysCollection

Remarks

This method is an O(1) operation and allocates a new fixed-size collection instance. The items are not copied.

Every modification to the builder invalidates any ValueDictionary<TKey, TValue>.Builder.KeysCollection obtained before that moment.

GetEnumerator()

Returns a new KeysEnumerator.

Typically, you don't need to manually call this method, but instead use the built-in foreach syntax.

public readonly ValueDictionary<TKey, TValue>.Builder.KeysEnumerator GetEnumerator()

Returns

ValueDictionary<TKey, TValue>.Builder.KeysEnumerator

MoveNext()

Advances the enumerator to the next element of the collection.

public bool MoveNext()

Returns

bool