V
V
Vitaly Kolesnik2018-03-06 23:00:25
.NET
Vitaly Kolesnik, 2018-03-06 23:00:25

What's the difference between IEnumerable and IEnumerator interfaces?

From my approximate knowledge, the IEnumerator interface provides access to different elements from a particular collection, and the IEnumerable interface provides access to a class object that implements IEnumerator.
When do you need to use these interfaces separately and does it make sense to use both at once?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2018-03-06
@VK28111995

The entity being run over must implement IEnumerable.
The entity that runs must implement IEnumerator (usually a nested, often privately declared class).
What you said, I unfortunately did not understand.

R
Roman, 2018-03-08
@yarosroman

Enumerable - enumerable, Enumerator - enumerator (from English), when you sleep, sheep is IEnumerable, and you who counts them - IEnumerator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question