Skip to main content
Source: AL0025PreferStaticLambdaAnalyzer.cs

Description

Lambda expressions and anonymous methods that don’t capture variables should be marked ‘static’ to avoid unnecessary allocations and improve performance.

Bad Code

Good Code

Properties

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

Configuration