static void Main(string[] args) { //Create 4 Person objects Person p1 = new Person() { Name = "John", Age = 41 }; Person p2 = new Person() { Name = "Jane", Age = 69 }; Person p3 = new Person() { Name = "Jake", Age = 12 }; Person p4 = new Person() { Name = "Jessie", Age = 25 }; //Create a list of Person objects and fill it List<Person> people = new List<Person>() { p1, p2, p3, p4 }; DisplayPeople("Children:", people, IsChild); DisplayPeople("Adults:", people, IsAdult); DisplayPeople("Seniors:", people, IsSenior); setcellvlaue(row: 1, column: 4, value: "ceert"); Console.Read(); }
static bool IsSenior(Person p) { return p.Age >= 65; }
static bool IsAdult(Person p) { return p.Age >= 18 && p.Age <=64 ; }
//==========FILTERS=================== static bool IsChild(Person p) { return p.Age <= 18; }