DevElf 0.4.3-alpha.0
dotnet add package DevElf --version 0.4.3-alpha.0
NuGet\Install-Package DevElf -Version 0.4.3-alpha.0
<PackageReference Include="DevElf" Version="0.4.3-alpha.0" />
<PackageVersion Include="DevElf" Version="0.4.3-alpha.0" />
<PackageReference Include="DevElf" />
paket add DevElf --version 0.4.3-alpha.0
#r "nuget: DevElf, 0.4.3-alpha.0"
#:package DevElf@0.4.3-alpha.0
#addin nuget:?package=DevElf&version=0.4.3-alpha.0&prerelease
#tool nuget:?package=DevElf&version=0.4.3-alpha.0&prerelease
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.
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+
Related Packages
- DevElf.Logging - Advanced logging scopes and message accumulation
License
This project is licensed under the MIT License.
| Product | Versions 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. |
-
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 |