collections/collection/3/prog.cs - A sample client of AnimalFarm. | Lecture 12 - slide 35 : 36 Program 10 |
using System; using System.Collections.ObjectModel; class App{ public static void Main(){ AnimalFarm af = new AnimalFarm(); // Populating the farm with Add af.Add(new Animal("elephant", AnimalGroup.Mammal)); af.Add(new Animal("blueJay", AnimalGroup.Bird)); af.Add(new Animal("giraffe", AnimalGroup.Mammal)); af.Add(new Animal("tiger", AnimalGroup.Mammal)); af.Add(new Animal("goldenEagle", AnimalGroup.Bird)); foreach(Animal a in af.GetGroup(AnimalGroup.Bird)) Console.WriteLine("{0}", a); } }