Use nameof() instead of a string literal
Recipe ID
OpenRewrite.Recipes.CSharp.CodeQuality.Wpf.UseNameofInsteadOfLiteralArtifactOpenRewrite.Recipes.CSharp.CodeQualityRegistering a DependencyProperty, RoutedEvent or RoutedCommand with a string literal silently breaks when the corresponding member is renamed. Replaces the literal with nameof(...) when a member of that name exists on the containing 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.UseNameofInsteadOfLiteralIf the recipe isn’t available locally, install it with:
mod config recipes nuget install OpenRewrite.Recipes.CSharp.CodeQuality