GaEpd.GuardClauses
2.1.0
Prefix Reserved
dotnet add package GaEpd.GuardClauses --version 2.1.0
NuGet\Install-Package GaEpd.GuardClauses -Version 2.1.0
<PackageReference Include="GaEpd.GuardClauses" Version="2.1.0" />
paket add GaEpd.GuardClauses --version 2.1.0
#r "nuget: GaEpd.GuardClauses, 2.1.0"
// Install GaEpd.GuardClauses as a Cake Addin #addin nuget:?package=GaEpd.GuardClauses&version=2.1.0 // Install GaEpd.GuardClauses as a Cake Tool #tool nuget:?package=GaEpd.GuardClauses&version=2.1.0
Georgia EPD-IT Guard Clauses Library
This package was created by Georgia EPD-IT to provide simple guard clause methods for our web applications.
This package was inspired by the great GuardClauses package by Steve Smith, which has a lot more options and extensibility.
How to install
To install, search for "GaEpd.GuardClauses" in the NuGet package manager or run the following command:
dotnet add package GaEpd.GuardClauses
How to use
Guard clauses simplify checking for invalid input parameters.
Example usage:
public class SomeClass
{
private readonly string _name;
public SomeClass(string name)
{
_name = Guard.NotNullOrWhiteSpace(name);
}
}
Each clause returns the original value if the conditions are met; otherwise, it throws an exception.
NotNull
– ensures a value is not null.NotNullOrWhiteSpace
– ensures a string is not null, empty, or whitespace.ValidLength
– ensures a string has a length between the specified minimum and maximum (inclusive).NotNegative
– ensures an integer is not negative.Positive
– ensures an integer is not zero or negative.RegexMatch
– ensures a string matches the provided regex pattern.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on GaEpd.GuardClauses:
Package | Downloads |
---|---|
GaEpd.AppLibrary
Core app library with entities, repositories, and more |
GitHub repositories
This package is not used by any popular GitHub repositories.