net7.0
Extension method to facilitate the creation of a Guard from a variable.
Published
Jul 5, 2023
3y ago
Total Downloads
5.9K
5,935
Install
dotnet add package Dybal.Utils.Guards.ObjectExtensions --version 1.0.0-pre-06
| 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
v1.0.0-pre-05v1.0.0-pre-06
Added Frameworks
net7.0
Removed Frameworks
net6.0
Added Dependencies
Dybal.Utils.Guards(net7.0)
Microsoft.CodeAnalysis.CSharp(net7.0)
Removed Dependencies
Dybal.Utils.Guards(net6.0)
Microsoft.CodeAnalysis.CSharp(net6.0)
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.