This tutorial is about enumerable interfaces and classes.
The tutorial has two parts.
One is the theory and shows us the basic information.
The last part comes with a commented step-by-step source part that allows you to understand how to build classes for the enumerable issue.
Enumerable is a module used in the Array class that gives you Enumerator.
An Enumerator is an object that returns each item in a collection in a specific order
Both IEnumerable and IEnumerator are interfaces that implement the iterator software design pattern in the .Net
IEnumerable is a basic interface used to obtain an object that knows how to iterate or enumerate over the elements in the collection.
The IEnumerable interface actually uses IEnumerator.
IEnumerable is an interface that defines one method GetEnumerator which returns an IEnumerator interface that iterates through a collection.
The IEnumerable method can be defined into the source code like this:

IEnumerator has these methods:

The default code to start an interface named Test_001 is this:

I create a console C# project named console_Enumerables__test_001 with Visual Studio 2019.
The next source code comes with a simple example and shows you each step to solve this issue about how to deal with classes and interfaces.
Each step from one to nine solves a programming problem.
The first step starts with an array and finishes with the value values to the class where you can continue with your own source code.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.