Use LINQ DistinctBy()
ProprietaryReplace collection.GroupBy(selector).Select(g => g.First()) with collection.DistinctBy(selector). Available since .NET 6.
OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseLinqDistinctBymod run . --recipe= OpenRewrite. Recipes. CSharp. Migration. Dotnet. Net6. UseLinqDistinctByInstall it once, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.