Description
Field names should not conflict with primary constructor parameters to avoid shadowing and confusion.Bad Code
Good Code
Properties
- Category: Design
- Severity: Warning
- Enabled by default: True
- Code fix available: False
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Field names should not conflict with primary constructor parameters
public class Service(ILogger logger)
{
private ILogger logger;
}
public class Service(ILogger logger)
{
private ILogger _logger = logger;
}
dotnet_diagnostic.AL0006.severity = warning
Was this page helpful?
