Class NullDictionaryEnumerator
An always empty IDictionaryEnumerator.
public sealed class NullDictionaryEnumerator : IDictionaryEnumerator, IEnumerator
- Inheritance
-
NullDictionaryEnumerator
- Implements
- Inherited Members
Remarks
A singleton implementation of the IDictionaryEnumerator over a collection that is empty and not modifiable.
Properties
Current
Gets the current object from the enumerator.
public object Current { get; }
Property Value
Remarks
Throws an InvalidOperationException because the NullDictionaryEnumerator never has a current value.
Exceptions
- InvalidOperationException
The collection is empty and Current cannot be positioned over a valid location.
Entry
Gets the current entry from the enumerator.
public DictionaryEntry Entry { get; }
Property Value
Remarks
Throws an InvalidOperationException because the NullDictionaryEnumerator never has a current entry.
Exceptions
- InvalidOperationException
The collection is empty and Current cannot be positioned over a valid location.
Instance
Gets the singleton instance of the NullDictionaryEnumerator.
public static NullDictionaryEnumerator Instance { get; }
Property Value
- NullDictionaryEnumerator
The singleton instance of the NullDictionaryEnumerator.
Remarks
Gets the singleton instance of the NullDictionaryEnumerator.
Key
Gets the current key from the enumerator.
public object Key { get; }
Property Value
Remarks
Throws an exception because the NullDictionaryEnumerator never has a current value.
Exceptions
- InvalidOperationException
The collection is empty and Current cannot be positioned over a valid location.
Value
Gets the current value from the enumerator.
public object Value { get; }
Property Value
- object
The current value from the enumerator.
Remarks
Throws an InvalidOperationException because the NullDictionaryEnumerator never has a current value.
Exceptions
- InvalidOperationException
The collection is empty and Current cannot be positioned over a valid location.
Methods
MoveNext()
Test if the enumerator can advance, if so advance.
public bool MoveNext()
Returns
- bool
falseas the NullDictionaryEnumerator cannot advance.
Remarks
As the enumerator is over an empty collection its Current
value cannot be moved over a valid position, therefore MoveNext()
will always return false.
Reset()
Resets the enumerator back to the start.
public void Reset()
Remarks
As the enumerator is over an empty collection Reset() does nothing.