Skip to main content
Source: AL0002DontRepeatNegatedPatternAnalyzer.cs

Description

The negated pattern should not be repeated multiple times.

Bad Code

if (x is not null and not 0 and not 1)

Good Code

if (x is not (null or 0 or 1))

Properties

  • Category: Design
  • Severity: Warning
  • Enabled by default: True
  • Code fix available: True

Configuration

dotnet_diagnostic.AL0002.severity = warning