pluralsight-linq-fundamentals/yield_test/Program.cs

23 lines
423 B
C#

using System;
using System.Collections;
namespace yield_test
{
class Program
{
static void Main(string[] args)
{
foreach (var number in GetNumbers())
{
Console.WriteLine(number);
}
}
static IEnumerable GetNumbers()
{
yield return 1;
yield return 2;
yield return 3;
}
}
}