Editorconfig Guide.e

Prefer pattern matching

EditorConfig key: csharp-style-prefer-pattern-matching

Prefer pattern matching

csharp-style-prefer-pattern-matching

This option controls whether pattern matching constructs should be preferred over equivalent conditional logic.

Default value:

true

Possible values:

  • true
  • false

Examples

true
if(o is default(int)
   or > (default(int)))
false
if(o == default(int)
   || o > (default(int))