Editorconfig Guide.e

Prefer local over anonymous function

EditorConfig key: csharp-style-prefer-local-over-anonymous-function

Prefer local over anonymous function

csharp-style-prefer-local-over-anonymous-function

This option controls whether local functions should be preferred over anonymous functions assigned to delegates.

Default value:

true

Possible values:

  • true
  • false

Examples

true
Func<int, int> square = x =>  { return x * x; };
false
int Square(int x) { return x * x; }