Editorconfig Guide.e

Prefer null check over type check

EditorConfig key: csharp-style-prefer-null-check-over-type-check

Prefer null check over type check

csharp-style-prefer-null-check-over-type-check

This option controls whether null checks should be preferred over type checks when testing for null.

Default value:

true

Possible values:

  • true
  • false

Examples

true
if (o is null)
false
if (o is not IEnumerable<int>)