YAGuard NuGet Package

Yet Another Guard argument validation package.
The speciality is that validation statements only take the argument, but they don't need the name of the argument as a second argument; still, the name of the argumnet is included in validation exceptions thrown.
Usage:
public void MyFunc(string myArg)
{
Guard.AgainstNull(myArg);
// or
Guard.AgainstNull( () => myArg );
// or
string validatedArg = Guard.AgainstNull(myArg);
}
In case myArg is null, this will throw an ArgumentNullException with the correct argument name.

Supports single line argument checking and assignment as well:
string result = Guard.AgainstNull(string source);
will set result to source in case it is not null, or throw an appropriate ArgumentNullException in case it is null.




Got any YAGuard Question?





Info

Version: 2.0.0
Author(s): Balint Nagy
Last Update: Monday, June 24, 2024
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/balintn22/YAGuard
NuGet Url: https://www.nuget.org/packages/YAGuard


Install
Install-Package YAGuard
dotnet add package YAGuard
paket add YAGuard
YAGuard Download (Unzip the "nupkg" after downloading)

.NETStandard 2.0
  • No dependencies.
net452
  • No dependencies.
netcoreapp2.1
  • No dependencies.




STATS

must-have-score

1.5

avg-downloads-per-day

7

days-since-last-release

403