← All recipes
Moderne licensed

Find ToImmutable*() that could use Frozen collections

Recipe IDOpenRewrite.Recipes.CSharp.Migration.Dotnet.Net8.FindFrozenCollectionArtifactOpenRewrite.Recipes.CSharp.Migration.Dotnet

Finds 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.FindFrozenCollection

If the recipe isn’t available locally, install it with:

mod config recipes nuget install OpenRewrite.Recipes.CSharp.Migration.Dotnet