Customer1 does not implement IEnumerable, but it doesn't have to that in code:
Customer1[] customers = new Customer1[] { ... };
foreach (var obj in customers)
...
because all Array (and other collections) do implement IEnumerable.
Interfaces are a contract, they say "it you do this and that, you are a member of the club, and get all club privileges". The "this and that" are the properties, methods, and so forth that are defined to be part of the interface.
In the case of IEnumerable, you just have to implement the following method:
public IEnumerator GetEnumerator()
{
...
}
And
How to implement IEnumerable in C#[
^] will show you how to do that.
If you do, then your class can be directly used as the
foreach
"collection":
foreach (MyClass mc in MyClassThatImplementsIEnumerable)
{
...
}