Find ToImmutable*() that could use Frozen collections
Recipe ID
OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindFrozenCollectionArtifactOpenRewrite.Recipes.CSharp.Migration.DotnetFinds usages of ToImmutableDictionary() and ToImmutableHashSet(). In .NET 8+, ToFrozenDictionary() and ToFrozenSet() provide better read performance.
Single recipemodernizationsearchdotnetnet8Proprietary
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe OpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindFrozenCollectionIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet