Optimize LINQ Select().Max()

Proprietary

Replace items.Select(selector).Max() with items.Max(selector). Passing the selector directly to Max avoids an intermediate iterator.

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

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