net6.0
Extension method to facilitate the creation of a Guard from a variable.
Published
Nov 24, 2022
3y ago
Total Downloads
5.9K
5,935
Install
dotnet add package Dybal.Utils.Guards.ObjectExtensions --version 1.0.0-pre-05
| Product | Versions |
|---|---|
| .NET |
README
Dybal.Utils.Guards.ObjectExtensions
Extension method to facilitate the creation of a ArgumentGuard from a variable.
You can use the shortcut id.Guard() instead of Guard.Argument(id). It's up to you what you prefer!
Foo(Guid id, string bar)
{
Id = Guard.Argument(id).NotDefault();
Bar = Guard.Argument(bar).NotNullOrWhiteSpace().MinLength(5).MaxLength(20);
}
Foo(Guid? id, string bar)
{
Id = id.Guard().NotDefault();
Bar = bar.Guard().NotNullOrWhiteSpace().MinLength(5).MaxLength(20);
}
Changes from Previous Version
No structural changes between v1.0.0-pre-04 and v1.0.0-pre-05.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.