using System; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Collections; public class AnimalFarm: Collection{ // Return an iterator of all animals in group g public IEnumerable GetGroup(AnimalGroup g){ foreach(Animal a in this) if (a.Group == g) yield return a; } // Additional methods }