Description
UseGuard.NotEmpty() instead of verbose empty-GUID 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.
Use Guard.NotEmpty() instead of verbose if (guid == Guid.Empty) throw patterns
Guard.NotEmpty() instead of verbose empty-GUID check and throw patterns.
public void Load(Guid id)
{
if (id == Guid.Empty)
throw new ArgumentException("GUID cannot be empty", nameof(id));
}
public void Load(Guid id)
{
Guard.NotEmpty(id);
}
dotnet_diagnostic.AL0050.severity = warning
Was this page helpful?
