> ## Documentation Index
> Fetch the complete documentation index at: https://ancplua.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AL0014 - Prefer pattern matching for null and zero comparisons

> Pattern matching syntax (is/is not) is more expressive and idiomatic

Source: [AL0014PreferPatternMatchingAnalyzer.cs](https://github.com/ANcpLua/ANcpLua.Analyzers/blob/main/src/ANcpLua.Analyzers/Analyzers/AL0014PreferPatternMatchingAnalyzer.cs)

## Description

Pattern matching syntax (is/is not) is more expressive and idiomatic. For null checks, it also bypasses overloaded equality operators.

## Bad Code

```csharp theme={null}
if (x == null)
if (x != 0)
```

## Good Code

```csharp theme={null}
if (x is null)
if (x is not 0)
```

## Properties

* **Category**: Style
* **Severity**: Warning
* **Enabled by default**: True
* **Code fix available**: True

## Configuration

```editorconfig theme={null}
dotnet_diagnostic.AL0014.severity = warning
```
