codegenomeproject
Search
MarketplaceModules
PackagesCLIMCP
Sign in
  1. Marketplace
  2. C#/.NET
  3. LINQ code quality

LINQ code quality

Proprietary

Optimize LINQ method calls for better readability and performance.

OpenRewrite.Recipes.CSharp.CodeQuality.Linq.LinqCodeQuality
mod run . --recipe=OpenRewrite.Recipes.CSharp.CodeQuality.Linq.LinqCodeQuality

Install it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

Recipe
  1. Optimize LINQ Where().Any()
  2. Optimize LINQ Where().Count()
  3. Optimize LINQ Where().First()
  4. Optimize LINQ Where().FirstOrDefault()
  5. Optimize LINQ Where().Single()
  6. Optimize LINQ Where().SingleOrDefault()
  7. Optimize LINQ Where().Last()
  8. Optimize LINQ Where().LastOrDefault()
  9. Optimize LINQ Where().LongCount()
  10. Optimize LINQ Select().Max()
  11. Optimize LINQ Select().Min()
  12. Optimize LINQ Select().Sum()
  13. Optimize LINQ Select().Average()
  14. Use ThenBy instead of second OrderBy
  15. Use OrderBy().ThenByDescending()
  16. Use OrderByDescending().ThenByDescending()
  17. Use Order() instead of OrderBy() with identity
  18. Remove useless OrderBy call
  19. Use Cast<T>() instead of Select with cast
  20. Combine LINQ methods
  21. Use Where before OrderBy
  22. Use Any() instead of Count() > 0
  23. Find Count() comparison that could be optimized
© Moderne, 2026
Recipe indexPrivacyTerms