Headless.Checks 0.4.15

dotnet add package Headless.Checks --version 0.4.15
                    
NuGet\Install-Package Headless.Checks -Version 0.4.15
                    
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="Headless.Checks" Version="0.4.15" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Headless.Checks" Version="0.4.15" />
                    
Directory.Packages.props
<PackageReference Include="Headless.Checks" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Headless.Checks --version 0.4.15
                    
#r "nuget: Headless.Checks, 0.4.15"
                    
#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.
#:package Headless.Checks@0.4.15
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Headless.Checks&version=0.4.15
                    
Install as a Cake Addin
#tool nuget:?package=Headless.Checks&version=0.4.15
                    
Install as a Cake Tool

Headless.Checks

Guard clause library for argument validation and defensive programming.

Problem Solved

Provides a fluent, expressive API for validating method arguments and ensuring preconditions, eliminating boilerplate validation code and standardizing error messages.

Key Features

  • Argument Validation: Extensive static methods on Argument class
  • Runtime Assertions: Ensure class for internal state validation
  • Performance Optimized: AggressiveInlining and DebuggerStepThrough
  • Caller Expression Support: Automatic parameter name capture
  • Type Support: Nullable, Span<T>, ReadOnlySpan<T>, collections, strings

Installation

dotnet add package Headless.Checks

Quick Start

Argument Validation

using Headless.Checks;

public void CreateUser(string name, int age, List<string> roles)
{
    Argument.IsNotNullOrEmpty(name);
    Argument.IsPositive(age);
    Argument.IsNotNullOrEmpty(roles);
    Argument.HasNoNulls(roles);
}

Common Checks

  • Argument.IsNotNull(value)
  • Argument.IsNotNullOrEmpty(string|collection)
  • Argument.IsNotNullOrWhiteSpace(string)
  • Argument.IsPositive(number) / IsNegative / IsPositiveOrZero / IsNegativeOrZero
  • Argument.IsOneOf(value, allowedValues)
  • Argument.IsInEnum(enumValue)
  • Argument.HasNoNulls(collection)
  • Argument.FileExists(path) / DirectoryExists(path)

Runtime Assertions

using Headless.Checks;

public void ProcessOrder()
{
    Ensure.True(_initialized, "Service must be initialized.");
    Ensure.NotDisposed(_disposed, this);
    Ensure.False(_queue.IsEmpty, "Queue should not be empty.");
}

Configuration

No configuration required.

Dependencies

None.

Side Effects

None.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Headless.Checks:

Package Downloads
Headless.Extensions

Package Description

Headless.Core

Package Description

Headless.Api.DataProtection

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.15 133 5/18/2026
0.4.14 147 5/18/2026