DevElf 0.4.3-alpha.0

This is a prerelease version of DevElf.
dotnet add package DevElf --version 0.4.3-alpha.0
                    
NuGet\Install-Package DevElf -Version 0.4.3-alpha.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="DevElf" Version="0.4.3-alpha.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DevElf" Version="0.4.3-alpha.0" />
                    
Directory.Packages.props
<PackageReference Include="DevElf" />
                    
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 DevElf --version 0.4.3-alpha.0
                    
#r "nuget: DevElf, 0.4.3-alpha.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.
#:package DevElf@0.4.3-alpha.0
                    
#: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=DevElf&version=0.4.3-alpha.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DevElf&version=0.4.3-alpha.0&prerelease
                    
Install as a Cake Tool

DevElf

Essential .NET utilities for argument validation and string handling that make day-to-day development simpler and safer.

This library is currently in development and is not ready for production use.

The API is subject to breaking changes without notice. Features may be incomplete or unstable. Use at your own risk in non-production environments only.

NuGet Version

Features

  • Argument validation extensions - Fluent validation methods that throw appropriate exceptions
  • Nullable string helpers - Readable extension methods for common string null/empty checks

Installation

dotnet add package DevElf

Quick Start

Argument Validation

using DevElf.ArgumentValidation;

void ProcessData(string name, int? id, DayOfWeek day)
{
    name.ThrowIfNullOrWhiteSpace();     // throws ArgumentException if null/empty/whitespace
    id.ThrowIfNull();                   // throws ArgumentNullException if null
    day.ThrowIfNotDefined();            // throws ArgumentException if undefined enum value

    // Safe to use validated parameters
}

String Extensions

using DevElf.Extensions;

string? input = GetUserInput();

if (input.IsNullOrWhiteSpace())
{
    Console.WriteLine("Please provide valid input");
    return;
}

// input is guaranteed to have content
ProcessInput(input);

API Reference

Argument Validation Extensions

Method Description
ThrowIfNull<T>(this T? value) Throws ArgumentNullException if value is null
ThrowIfNullOrEmpty(this string? value) Throws ArgumentException if string is null or empty
ThrowIfNullOrWhiteSpace(this string? value) Throws ArgumentException if string is null, empty, or whitespace
ThrowIfNotDefined<T>(this T value) where T : Enum Throws ArgumentException if enum value is not defined

String Extensions

Method Description
IsNull(this string? text) Returns true if string is null
IsNullOrEmpty(this string? text) Returns true if string is null or empty
IsNullOrWhiteSpace(this string? text) Returns true if string is null, empty, or whitespace

All string extension methods are annotated with [NotNullWhen(false)] for improved nullable reference type support.

Requirements

  • .NET 10.0+
  • DevElf.Logging - Advanced logging scopes and message accumulation

License

This project is licensed under the MIT License.

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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DevElf:

Package Downloads
DevElf.Logging

Logging extensions and tools for .NET applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.4.3-alpha.0 154 10/6/2025
0.4.0-alpha.7 167 9/30/2025
0.4.0-alpha.6 155 9/30/2025
0.3.5-alpha.5 133 9/28/2025