pluralsight-linq-fundamentals/yield_test/Program.cs

23 lines
423 B
C#
Raw Normal View History

2021-05-11 10:29:07 +10:00
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;
}
}
}