Editorconfig Guide.e

Prefer expression bodied lambdas

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

Prefer expression bodied lambdas

csharp-style-expression-bodied-lambdas

This option controls whether lambda expressions should be written using expression-bodied syntax instead of a block body.

Default value:

true

Possible values:

  • true
  • false
  • when_on_single_line

Examples

true
Func<int, int> square =
  x => x * x;
false
Func<int, int> square =
  x => { return x * x; };
when_on_single_line
Func<int, int> square =
  x => x * x;