Yield Return

A statement that produces the next value from an iterator without building the whole sequence first.

What is Yield Return in C#?

Yield Return — A statement that produces the next value from an iterator without building the whole sequence first.

class Countdown
{
    IEnumerable<int> Numbers()
    {
        yield return 3;
        yield return 2;
        yield return 1;
    }
}

Level: Freelancer · More C# terms at this level

Updated