Editorconfig Guide.e

Prefer expression bodied methods

EditorConfig key: csharp-style-expression-bodied-methods

Prefer expression bodied methods

csharp-style-expression-bodied-methods

This option controls whether methods should be written using expression-bodied syntax.

Default value:

false

Possible values:

  • true
  • false
  • when_on_single_line

Examples

true
public string GetName()
 => Name;
false
public string GetName()
{
  return Name;
}
when_on_single_line
public string GetName()
  => Name;