← All recipes
Moderne licensed

Use System.Threading.Lock instead of object for locking

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Style.FindUseSystemThreadingLockArtifactOpenRewrite.Recipes.CSharp.CodeQuality

In .NET 9+, use System.Threading.Lock instead of object for lock objects. The dedicated Lock type provides better performance.

Single recipecsharpstylecode-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.Style.FindUseSystemThreadingLock

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

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