Practicing and exploring
Test your knowledge and understanding by answering some questions, get some hands-on practice, and explore, with deeper research into the topics covered in this chapter.
Exercise 9.1 – test your knowledge
Answer the following questions:
What are the two requirements to use LINQ?
Which LINQ extension method would you use to return a subset of properties from a type?
Which LINQ extension method would you use to filter a sequence?
List five LINQ extension methods that perform aggregation.
What is the difference between the
Select
andSelectMany
extension methods?
Exercise 9.2 – practice querying with LINQ
Create a console application named Ch09_Exercise02 that prompts the user for a city and then lists the company names for Northwind customers in that city, as shown in the following output:
Enter the name of a city: London There are 6 customers in London: Around the Horn B's Beverages Consolidated Holdings Eastern Connection North/South Seven Seas Imports
Enhance the application...