Chapter 9 - Querying and Manipulating Data with LINQ

  1. What are the two required parts of LINQ?
    • A LINQ provider and the LINQ extension methods. 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 a sequence?
    • 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.
    • List five LINQ extension methods that perform aggregation.
    • Max, Min, Count, Average, Sum, and Aggregate.
  4. What is the difference between the Select and SelectMany extension methods?
    • Select returns exactly what you specify to return. SelectMany checks that the items you have selected are themselves IEnumerable<T> and then breaks them down into smaller parts. For example, if the type you select is a string value (which is IEnumerable<char>), SelectMany will break each string value returned into their individual char values.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.202.240