← All recipes
Moderne licensed

Find closure in GetOrAdd/AddOrUpdate factory

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Performance.FindAvoidClosureInMethodArtifactOpenRewrite.Recipes.CSharp.CodeQuality

Detect closures in lambdas passed to GetOrAdd or AddOrUpdate. Use the factory overload that accepts a state argument to avoid allocations.

Single recipecsharpperformancecode-qualityProprietary

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.CodeQuality.Performance.FindAvoidClosureInMethod

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

mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality