Editorconfig Guide.e

Prefer throw expression

EditorConfig key: csharp-style-throw-expression

Prefer throw expression

csharp-style-throw-expression

This option controls whether throw expressions should be preferred over throw statements where possible.

Default value:

true

Possible values:

  • true
  • false

Examples

true
var x = y ?? throw new ArgumentNullException();
false
var x = y == null ? throw new ArgumentNullException() : y;