Struct ValueDictionary<TKey, TValue>.Builder.ValuesEnumerator
- Namespace
- Badeend.ValueCollections
- Assembly
- Badeend.ValueCollections.dll
This type facilitates reading only the values of a dictionary.
public struct ValueDictionary<TKey, TValue>.Builder.ValuesEnumerator
- Inherited Members
Remarks
This is a stack-allocated enumerator over the values in the dictionary. Any ValuesEnumerator is only valid unti the next mutation performed on the builder. After which, a new ValuesEnumerator must be obtained.
To prevent accidental boxing, ValuesEnumerator does not implement any interface. If you want to use the values 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 TValue Current { get; }
Property Value
- TValue
Methods
AsCollection()
Create a new heap-allocated temporary view over the values in the dictionary.
public readonly ValueDictionary<TKey, TValue>.Builder.ValuesCollection AsCollection()
Returns
- ValueDictionary<TKey, TValue>.Builder.ValuesCollection
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.ValuesCollection obtained before that moment.
GetEnumerator()
Returns a new ValuesEnumerator.
Typically, you don't need to manually call this method, but instead use
the built-in foreach
syntax.
public readonly ValueDictionary<TKey, TValue>.Builder.ValuesEnumerator GetEnumerator()
Returns
- ValueDictionary<TKey, TValue>.Builder.ValuesEnumerator
MoveNext()
Advances the enumerator to the next element of the collection.
public bool MoveNext()