Skip to content
This repository was archived by the owner on Sep 1, 2021. It is now read-only.

Collections

Tolik Pylypchuk edited this page May 28, 2018 · 6 revisions

Empty collections

Empty Enumerable

An EmptyEnumerable<T> is an enumerable which doesn't contain any elements. This class has no state and is implemented as a singleton. The single instance can be accessed via the Instance property.

The GetEnumerator method returns an EmptyEnumerator<T>.

Examples of usage are available here.

Empty Enumerator

An empty enumerator of type T is represented by the class EmptyEnumerator<T>. This class has no state and is implemented as a singleton. The single instance can be accessed via the Instance property.

MoveNext() does nothing and always returns false. Reset() and Dispose() also do nothing.

Current throws an InvalidOperationException. This property should never be called as per the specification of enumerators (because MoveNext() returns false).

Examples of usage are available here.

Clone this wiki locally