Uploaded March 2021 | Updated November 2026, 3 hours ago
Programming With Intent chapters: matlus.com/pwi LINQ introduces inefficiencies in the form of hidden allocations. The C# Team's coding guidelines say:
1. Avoid LINQ
2. Avoid using foreach over collections that do not have a struct enumerator
3. Consider using an object pool. There are many usages of object pools in the compiler to see an example
Having a good understanding what LINQ is does internally should yield enough information to know whether you are taking a performance hit. LINQ, as a built-in technology, has performance advantages and disadvantages. The code behind the extension methods has had considerable performance attention paid to it by the .NET team.
The code shown in this video can be found here:
github.com/matlus/VariousBenchmarks More articles and Programming With Intent chapters: matlus.com
Read the article: matlus.com/writing/to-linq-or-not-to-linq
Programming With Intent chapters: matlus.com/pwi LINQ introduces inefficiencies in the form of hidden allocations. The C# Team's coding guidelines say:
1. Avoid LINQ
2. Avoid using foreach over collections that do not have a struct enumerator
3. Consider using an object pool. There are many usages of object pools in the compiler to see an example
Having a good understanding what LINQ is does internally should yield enough information to know whether you are taking a performance hit. LINQ, as a built-in technology, has performance advantages and disadvantages. The code behind the extension methods has had considerable performance attention paid to it by the .NET team.
The code shown in this video can be found here:
github.com/matlus/VariousBenchmarks More articles and Programming With Intent chapters: matlus.com
Read the article: matlus.com/writing/to-linq-or-not-to-linq










