Skip to main content

RCS1016: Use block body or expression body

Properties

PropertyValue
Default Severitydisabled by default
Minimum language version6.0

Examples

Example #1

diagnostic.cs
public string Foo()
{
return "";
}
fix.cs
public string Foo() => "";

Configuration

info

One of the following options is required to be set for this analyzer to work:

  • roslynator_body_style
  • roslynator_use_block_body_when_declaration_spans_over_multiple_lines
  • roslynator_use_block_body_when_expression_spans_over_multiple_lines
.editorconfig
# Prefer block body or expression body
roslynator_body_style = block|expression

# Use block body when declaration spans over multiple lines
roslynator_use_block_body_when_declaration_spans_over_multiple_lines = true|false

# Use block body when expression spans over multiple lines
roslynator_use_block_body_when_expression_spans_over_multiple_lines = true|false

Applies to