Do we call such an instance a "collection"? An "enumerable"? Or something else? I ask with my two main goals being:
IEnumerable
.IEnumerable in C# is an interface that defines one method, GetEnumerator which returns an IEnumerator interface. This allows readonly access to a collection then a collection that implements IEnumerable can be used with a for-each statement.
IEnumerable is an interface defining a single method GetEnumerator() that returns an IEnumerator interface. It is the base interface for all non-generic collections that can be enumerated. This works for read-only access to a collection that implements that IEnumerable can be used with a foreach statement.
IEnumerable<T> is an interface that guarantees a given class is iterable. That's a technical term indicating a class that implements IEnumerable<T> can be thought of and used as a sequence of elements.
IEnumerable interface is used when we want to iterate among our classes using a foreach loop. The IEnumerable interface has one method, GetEnumerator, that returns an IEnumerator interface that helps us to iterate among the class using the foreach loop.
To be technically precise, I would inform developers that it implements IEnumerable.
To say anything else is being less informative.
Anyone who understands IEnumerable will immediately understand the capabilities of your class. Anyone who doesn't, wouldn't get it however you described it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With