Chapter 7: LINQ Performance
LINQ has a reputation for being slow. But contrary to people's views, there are ways to use LINQ that ensure optimal performance.
In this chapter, you will learn how to perform LINQ queries with performance in mind. Depending on how you use LINQ, different methods that return the same result can behave and perform differently. And so, in this chapter, you will learn how best to perform queries on LINQ to improve the performance of your applications.
Here, you will benchmark different ways to determine the most performative ways to obtain the last element of a LINQ query. You will learn about the performance penalty of using the let
keyword in LINQ statements, and why you should avoid using it. Benchmarking different Group By
methods, you will gain insight into the most performant way to perform GroupBy queries using LINQ. When performing queries and data manipulation using LINQ, there may be times when you need to use closures. By writing parametrized...