← All recipes
Moderne licensed

Convert a trivial dependency property callback to a lambda

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Wpf.ConvertTrivialCallbackToLambdaArtifactOpenRewrite.Recipes.CSharp.CodeQuality

A PropertyChangedCallback, CoerceValueCallback or ValidateValueCallback whose body is a single expression is inlined as a lambda at the registration, so the callback sits next to the property it belongs to. The method is removed when nothing else used it.

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

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

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