← All recipes
Moderne licensed

Cast the sender of a dependency property callback to the correct type

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.CastSenderToCorrectTypeArtifactOpenRewrite.Recipes.CSharp.CodeQuality

The DependencyObject passed to a PropertyChangedCallback or CoerceValueCallback is the type that registered the property. Replaces a cast, as, is or case conversion naming a type the sender can never be with the registering type.

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.CastSenderToCorrectType

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

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