Use LINQ DistinctBy()

Proprietary

Replace collection.GroupBy(selector).Select(g => g.First()) with collection.DistinctBy(selector). Available since .NET 6.

OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseLinqDistinctBy
mod run . --recipe=OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net6.UseLinqDistinctBy

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