using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
public static void Main()
var stopwatch = new Stopwatch();
var people = GetPeople();
foreach (var person in people) {
Console.WriteLine(person.FullName);
Console.WriteLine($"The operation took {stopwatch.ElapsedMilliseconds}ms");
private static IEnumerable<Person> GetPeople()
yield return new Person { FullName = "Shepherd", Age = 24 };
yield return new Person { FullName = "Samsara", Age = 32 };
yield return new Person { FullName = "Talos", Age = 11 };
public string FullName { get; set; }
public int Age { get; set; }