Table of Contents

MultiValueDictionary<TKey, TValue>.Enumerator Struct

Definition

Namespace
Bodu.Collections.Generic
Assembly
Bodu.Collections.dll
Package
Bodu.Collections 1.0.0
Source
MultiValueDictionary{T,T}.IEnumerable.cs

Enumerates the key-value-list pairs in a MultiValueDictionary<TKey, TValue>.

public struct MultiValueDictionary<TKey, TValue>.Enumerator : IEnumerator<KeyValuePair<TKey, IReadOnlyList<TValue>>>, IEnumerator, IDisposable
Implements
Inherited Members
Extension Methods

Remarks

Use the foreach statement to enumerate the dictionary rather than using this struct directly.

The enumerator provides read-only access. Modifying the underlying dictionary after enumeration begins invalidates the enumerator and causes MoveNext() or Reset() to throw InvalidOperationException.

Properties

Current

Gets the key-value-list pair at the current position of the enumerator.

public readonly KeyValuePair<TKey, IReadOnlyList<TValue>> Current { get; }

Property Value

KeyValuePair<TKey, IReadOnlyList<TValue>>

The key-value-list pair at the current enumerator position.

Exceptions

InvalidOperationException

Thrown when the enumerator is not positioned on an element.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

MoveNext()

Advances the enumerator to the next key-value-list pair.

public bool MoveNext()

Returns

bool

true if the enumerator advanced to the next pair; otherwise, false.

Exceptions

InvalidOperationException

Thrown when the dictionary was modified after the enumerator was created.

Reset()

Sets the enumerator to its initial position.

public void Reset()

Exceptions

InvalidOperationException

Thrown when the dictionary was modified after the enumerator was created.

Explicit Interface Implementations

IEnumerator.Current

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

readonly object IEnumerator.Current { get; }

Returns

object

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

Applies to

ProductVersions
.NET8, 10