Skip to main content
Source: AL0117UnnecessaryLinqMaterializationAnalyzer.cs

Description

Calling ToList() or ToArray() immediately after Where(), Select(), or other LINQ operators forces eager evaluation. If the result is only enumerated once, deferred execution avoids allocating an intermediate collection.

Properties

  • Category: Usage
  • Severity: Info
  • Enabled by default: True
  • Code fix available: False

Configuration

dotnet_diagnostic.AL0117.severity = info