GaEpd.GuardClauses 1.0.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package GaEpd.GuardClauses --version 1.0.0                
NuGet\Install-Package GaEpd.GuardClauses -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GaEpd.GuardClauses" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GaEpd.GuardClauses --version 1.0.0                
#r "nuget: GaEpd.GuardClauses, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GaEpd.GuardClauses as a Cake Addin
#addin nuget:?package=GaEpd.GuardClauses&version=1.0.0

// Install GaEpd.GuardClauses as a Cake Tool
#tool nuget:?package=GaEpd.GuardClauses&version=1.0.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

Nuget

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 Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.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.

Version Downloads Last updated
2.0.0 3,215 1/2/2024
1.0.0 846 10/25/2023

v1.0.0
- Initial release.