Use LINQ AggregateBy()

Proprietary

Replace collection.GroupBy(keySelector).ToDictionary(g => g.Key, g => g.Aggregate(seed, func)) with collection.AggregateBy(keySelector, seed, func).ToDictionary(). Available since .NET 9.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net9.UseLinqAggregateBy
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net9.UseLinqAggregateBy

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