samedi 12 mai 2018

Implement Iterator pattern without yield c#

How i could rewrite GetEnumerator method without using yield keyword? Code of method:

public IEnumerator<int> GetEnumerator()
{
    yield return 1;

    Console.WriteLine("1");

    yield return 2;
}

Just get to know how it can be implemented manually

Aucun commentaire:

Enregistrer un commentaire