在 C# 中开始使用 LINQ
Getting Started With LINQ in C#
- 1 - Introduction
- 1 -Getting Started
- 2 - LINQ vs. Loops
- 1 -Filter Collections Using Where
- 2 -Write Extensions Methods
- 3 -Write Delegates Using Func and Action
- 4 -Write Lambda Expressions
- 5 -Exercise Find Your Favorite Movies
- 6 -LINQ and Declarative Programming
- 7 -LINQ and Immutability
- 8 -LINQ and Laziness
- 9 -Wrap-up!
- 3 - Most Common LINQ Methods
- 1 -Transform a Collection With Select
- 2 -Transform a Collection Using the Position of Elements
- 3 -Query Collections with Any and All
- 4 -Group Elements of a Collection
- 5 -Group Elements and Transform Every Group
- 6 -Group Elements by More Than One Property
- 7 -Use Anonymous Objects With GroupBy
- 8 -Order Elements of a Collection
- 9 -Choose One Element with First and FirstOrDefault
- 10 -Choose One Element with Single and SingleOrDefault
- 11 -Choose and Leave Out Elements with Take and Skip
- 12 -Exercise Write a Paginate Method
- 13 -Exercise Refactor From Loops to LINQ
- 14 -Query Collections of Numbers With Sum, Min, and Max
- 15 -Flatten a Collection of Collections With SelectMany
- 16 -Find Unique Elements With Distinct
- 17 -Perform Set Operations With Intersect, Union, and Except
- 18 -Exercise Use LINQ Methods
- 19 -Wrap-up!
- 4 - Common LINQ Mistakes
- 1 -Use the Right LINQ Methods
- 2 -Write Null Checks with FirstOrDefault
- 3 -Avoid Multiple Evaluations of a LINQ Query
- 4 -Exercise Remove Mistakes
- 5 -Wrap-up!
- 5 - Refactoring With LINQ
- 1 -Replace Comparisons with Any
- 2 -Replace a Set of Choices with FirstOrDefault
- 3 -Validate Objects With All
- 4 -Exercise Add a Recommended Movie
- 5 -Wrap-up!
- 6 - New LINQ Features
- 1 -Split a Collection Into Buckets With Chunk
- 2 -Find Unique Elements With DistinctBy
- 3 -Use Take Method with Ranges
- 4 -Use FirstOrDefault with a Safe Default
- 5 -Wrap-up!
- 7 - Conclusion
- 1 -Wrap-up!