- Query extension methods return collections of anonymous objects with the requested information.

return
from g in zoo.Guests
where g.Age <= 10
select new { g.Name, g.Age };Return only the following properties:
Example: result = "Youngest Guests:\n"
Only animals who are heavier than 200 pounds should be shown, and only the selected properties should be shown. The result should look like the following:

Only dingos who are female should be shown, and only the selected properties should be shown. The result should look like the following:

Only guests who are 10 or younger should be shown, and only the selected properties should be shown. The result should look like the following:


Shark chum = new Shark("Chum", 14, 377.3, Gender.Male);
this.AddAnimal(chum);
Squirrel chip = new Squirrel("Chip", 4, 1.0, Gender.Male);
this.AddAnimal(chip);
this.AddAnimal(new Squirrel("Dale", 4, 0.9, Gender.Male));
Guest greg = new Guest("Greg", 35, 100.0m, WalletColor.Crimson, Gender.Male, new Account());
Guest darla = new Guest("Darla", 7, 10.0m, WalletColor.Brown, Gender.Male, new Account());
greg.AdoptedAnimal = chip;
darla.AdoptedAnimal = chum;
this.AddGuest(greg, new Ticket(0m, 0, 0));
this.AddGuest(darla, new Ticket(0m, 0, 0));They should be called "getguestsbyage", "getflyinganimals", "getadoptedanimals". Call each extension method in the appropriate case statement, and write the result to the console using the ForEach extension method.
All guests should be shown, but they should be sorted by age in ascending order. The resulting query should look like the following:

Only animals who are flying (e.g. eagles) should be shown. The resulting query should look like the following:

Greg and Darla should appear along with the animal they adopted. Greg should be the adopter and Chip should be the animal. Darla should be the adopter and Chum should be the animal. The resulting query should look like the following:


group g by g.Wallet.Color.ToString() into grby g.Wallet.Color.ToString() into grorderby gr..Keyselect new { gr.Key, TotalMoneyBalance = gr.Sum(g => g.Wallet.MoneyBalance) };Return only the following properties:
Call each extension method in the appropriate case-statments, and write the results to the console.
Only the wallet colors that existing guests have should be shown. The wallet money balance for all guests with that color wallet should be totaled. The resulting query should look like the following:

Only the types of existing animals should be shown (one for each type, not one for each animal). The weight for all animals of that type should be averaged. The resulting query should look like the following:

© 2026 Northcentral Technical College