Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the technically correct term for an instance of class which implements IEnumerable?

Do we call such an instance a "collection"? An "enumerable"? Or something else? I ask with my two main goals being:

  1. To be understood by other developers, without having to explain that the class implements IEnumerable.
  2. To be technically correct and precise.
like image 651
Matthew Avatar asked Jul 21 '11 21:07

Matthew


People also ask

What is IEnumerable class?

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.

What is meant by IEnumerable?

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.

What is IEnumerable T interface in C#?

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.

When we will use IEnumerable in C#?

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.


1 Answers

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.

like image 140
BonyT Avatar answered Oct 19 '22 23:10

BonyT