Chapter 9 – Querying and Manipulating Data with LINQ

  1. What are the two requirements to use LINQ?

    You must import the System.Linq namespace to make the LINQ extension methods available and reference a LINQ provider assembly for the type of data that you want to work with.

  2. Which LINQ extension method would you use to return a subset of properties from a type?

    The Select method allows projection (selection) of properties.

  3. Which LINQ extension method would you use to filter results?

    The Where method allows filtering by supplying a delegate (or lambda expression) that returns a Boolean to indicate whether the value should be included in the results.

  4. List five LINQ extension methods that perform aggregation.

    Max, Min, Count, Average, Sum, and Aggregate.

  5. What ...

Get C# 6 and .NET Core 1.0: Modern Cross-Platform Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.