Description
UseGuard.Positive() instead of verbose positive-check and throw patterns.
Bad Code
Good Code
Properties
- Category: Roslyn Utilities
- Severity: Warning
- Enabled by default: True
- Code fix available: True
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Guard.Positive() instead of verbose positive-check and throw patterns.
public void SetPageSize(int size)
{
if (size <= 0)
throw new ArgumentOutOfRangeException(nameof(size));
}
public void SetPageSize(int size)
{
Guard.Positive(size);
}
dotnet_diagnostic.AL0049.severity = warning
Was this page helpful?
