> ## 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.

# AL0005 - Use SequenceEqual when comparing Span with non-constants

> Use SequenceEqual instead of equality operators for Span non-constant comparisons

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

## Description

When comparing Span and a non-constant, use SequenceEqual instead of equality operators, unless you want to compare addresses.

## Bad Code

```csharp theme={null}
if (span1 == span2)
```

## Good Code

```csharp theme={null}
if (span1.SequenceEqual(span2))
```

## Properties

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

## Configuration

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