← All recipes
Moderne licensed

Use block body or expression body

Recipe IDOpenRewrite.Recipes.CSharp.CodeQuality.Style.UseBlockBodyOrExpressionBodyArtifactOpenRewrite.Recipes.CSharp.CodeQuality

Convert between block body and expression body for members.

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.Style.UseBlockBodyOrExpressionBody

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

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

Options

NameTypeDescription
AllowMultiLineBooleanWhen true, also flags methods with multi-line return expressions (e.g., switch expressions, multi-line conditionals). Default is false, matching Roslyn's default RCS1016 behavior.