← All recipes
Moderne licensed

Use the containing type when creating a ComponentResourceKey

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.UseContainingTypeForComponentResourceKeyArtifactOpenRewrite.Recipes.CSharp.CodeQuality

A ComponentResourceKey should name the type that declares it as its typeInTargetAssembly, because that is what tells WPF which assembly holds the resource. Corrects a mismatched typeof(...), and supplies the containing type and member when the key is created with no arguments at all.

Single recipecsharpcode-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.Wpf.UseContainingTypeForComponentResourceKey

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

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