Examples from Chapter 10 (LINQ) of Programming C# 10.0 (O'Reilly).
- Example 1. A LINQ query expression
- Example 2. The non-LINQ equivalent
- Example 3. Extracting just one property in a query
- Example 4. The effect of a query expression
- Example 5. How trivial select clauses expand
- Example 6. Query with a let clause
- Example 7. How multivariable query expressions expand (approximately)
- Example 8. Nonsensical Where and Select
- Example 9. A meaningless query
- Example 10. How the compiler transforms the meaningless query
- Example 11. A custom LINQ provider for CultureInfo[]
- Example 12. Query with an infinite source sequence
- Example 13. A custom deferred Where operator
- Example 14. Accidental reevaluation of a deferred query
- Example 20. Select operator with index
- Example 21. Indexed Select downstream of Where operator
- Example 22. Indexed Select upstream of Where operator
- Example 23. Fetching more data than is needed
- Example 24. A select clause with an anonymous type
- Example 25. Using Select to transform numbers
- Example 26. Using SelectMany from a query expression
- Example 27. SelectMany operator
- Example 28. Flattening a jagged array
- Example 29. SelectMany without item projection
- Example 30. One implementation of SelectMany
- Example 32. Query expression with orderby clause
- Example 33. How not to apply multiple ordering criteria
- Example 34. Multiple ordering criteria in a query expression
- Example 35. Multiple ordering criteria with LINQ operators
- Example 36. Applying the Single operator to a query
- Example 37. Single operator with predicate
- Example 38. Using First to select the longest course
- Example 39. SingleOrDefault with explicit default value
- Example 40. How not to use ElementAt
- Example 41. Average operator with projection
- Example 42. Max with projection
- Example 43. Max with projection for criteria but not for result
- Example 44. Max with projection for criteria but not for result with error on empty input
- Example 45. Sum and equivalent with Aggregate
- Example 46. Implementing Max with Aggregate
- Example 47. Implementing Average with Aggregate
- Example 48. Aggregating bounding boxes
- Example 49. More verbose and less obscure bounding box aggregation
- Example 50. The effect of Aggregate
- Example 53. Grouping query expression
- Example 54. Expanding a simple grouping query
- Example 55. Group query with item projection
- Example 56. Expanding a group query with an item projection
- Example 57. Group query with group projection
- Example 58. Expanded group query with group projection
- Example 59. GroupBy with key and group projections
- Example 60. GroupBy operator with key, item, and group projections
- Example 61. Composite group key