Ardalis.GuardClauses 6.0.0
Ardalis.GuardClauses
IMPORTANT This is the last MIT-licensed release of this library. Future releases will require a (potentially free) commercial license. Find out more
A simple extensible package with guard clause extensions.
A guard clause is a software pattern that simplifies complex functions by "failing fast", checking for invalid inputs up front and immediately failing if any are found.
Release Notes
This is the last MIT-licensed release of this library (see above).
- Updated to latest supported .NET frameworks (.NET 10, .NET 11) with continued NetStandard2.0 support (#419)
- Breaking: dropped the
net8.0andnetstandard2.1targets (.NET 8 and 9 are out of support). Projects that can't use .NET 10+ get thenetstandard2.0build instead.
- Breaking: dropped the
- Fixed
Guard.Against.Expressionso it works with reference types; thestructconstraint was removed (#339, #406) - Fixed
Guard.Against.LengthOutOfRangeso the exception keeps the parameter name and your custom message (#422) - Updated Microsoft.SourceLink.GitHub to 10.0.400 (#410)
- Package license is now declared as an MIT license expression, so it shows up on nuget.org and in license-scanning tools (#359)
- NuGet package now ships its own focused readme
Usage
public void ProcessOrder(Order order)
{
Guard.Against.Null(order);
// process order here
}
// OR
public class Order
{
private string _name;
private int _quantity;
private long _max;
private decimal _unitPrice;
private DateTime _dateCreated;
public Order(string name, int quantity, long max, decimal unitPrice, DateTime dateCreated)
{
_name = Guard.Against.NullOrWhiteSpace(name);
_quantity = Guard.Against.NegativeOrZero(quantity);
_max = Guard.Against.Zero(max);
_unitPrice = Guard.Against.Negative(unitPrice);
_dateCreated = Guard.Against.OutOfSQLDateRange(dateCreated);
}
}
Roadmap
This is our roadmap for this package:
Version 6.x
This version. The last MIT-licensed package.
Version 15.x
The next version. It will have minimal changes from 6.x but will have a dual license and a compile-time license check and any planned breaking changes will be marked [Obsolete] if possible to signal what's coming. It will also be released both as Ardalis.GuardClauses and as NimbleTools.GuardClauses but with identical behavior to make upgrades as easy as possible, both now and in the future.
Why the jump from 6 to 15? We want to consolidate the 3 Ardalis packages that are moving to commercial licensing (GuardClauses, SmartEnum, Specification) and, like Aspire, we want to keep our version numbers separated from .NET's version numbers. Starting at 15 for all 3 lets us do that.
Version 16.x
This is where we expect to introduce potentially breaking changes as we rethink, refactor, and improve the implementation of the library. We will not break the API without a good reason, but there are some inconsistencies and places where we can improve the usability and sometimes the performance and this will be the time to make such changes.
Stay informed of changes by adding your email here: https://nimbletools.io/updates
Showing the top 20 packages that depend on Ardalis.GuardClauses.
| Packages | Downloads |
|---|---|
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
62 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
59 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
56 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
56 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
55 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
55 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
54 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
54 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
52 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
51 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
50 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
47 |
|
Ardalis.SmartEnum
Classes to help produce strongly typed smarter enums in .NET.
|
47 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
45 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
42 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
39 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
29 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
27 |
|
Ardalis.Specification
A simple package with a base Specification class, for use in creating queries that work with Repository types.
|
26 |
- Version 6.0.0: This is the last MIT-licensed release of this library. Future releases will require a (potentially free) commercial license. See https://nimbletools.io/news/ardalis-nuget-packages/ * Updated target frameworks to net11.0, net10.0, and netstandard2.0; dropped net8.0 and netstandard2.1, which are no longer supported (#419) * Fixed Guard.Against.Expression to support reference types by removing the struct constraint (#339, #406) * Fixed Guard.Against.LengthOutOfRange so the exception keeps the parameter name and custom message (#422) * Updated Microsoft.SourceLink.GitHub to 10.0.400 (#410) * Package license is now declared as an MIT license expression (#359) * NuGet package now ships a dedicated readme (readme-nuget.md) * Updating to 5.0 because 4.6 had breaking logic (see #354) * Updated Obsolete message for Guard.Against.Expression to clarify reversal of logic (#457)
.NET 10.0
- No dependencies.
.NET 11.0
- No dependencies.
.NET Standard 2.0
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 6.0.0 | 5 | 11/27/2026 |
| 5.0.0 | 28 | 09/29/2026 |
| 4.6.0 | 17 | 10/10/2026 |
| 4.5.0 | 30 | 09/28/2026 |
| 4.4.0 | 19 | 10/04/2026 |
| 4.3.0 | 48 | 12/11/2025 |
| 4.2.0 | 54 | 12/12/2025 |
| 4.1.2 | 27 | 09/28/2026 |
| 4.1.1 | 25 | 09/29/2026 |
| 4.1.0 | 50 | 12/13/2025 |
| 4.0.1 | 59 | 12/13/2025 |
| 4.0.0 | 57 | 12/24/2025 |
| 3.3.0 | 53 | 12/14/2025 |
| 3.2.0 | 45 | 12/12/2025 |
| 3.1.0 | 55 | 12/13/2025 |
| 3.0.1 | 17 | 10/10/2026 |
| 3.0.0 | 22 | 09/29/2026 |
| 2.0.0 | 19 | 10/04/2026 |
| 1.5.0 | 50 | 12/13/2025 |
| 1.4.2 | 55 | 12/14/2025 |
| 1.4.1 | 38 | 12/15/2025 |
| 1.4.0 | 46 | 12/11/2025 |
| 1.3.3 | 44 | 12/14/2025 |
| 1.3.2 | 58 | 12/14/2025 |
| 1.3.1 | 53 | 12/11/2025 |
| 1.2.9 | 57 | 12/12/2025 |
| 1.2.8 | 43 | 12/22/2025 |
| 1.2.7 | 49 | 12/18/2025 |
| 1.2.6 | 54 | 12/12/2025 |
| 1.2.5 | 63 | 12/13/2025 |
| 1.2.4 | 58 | 12/14/2025 |
| 1.2.3 | 46 | 12/12/2025 |
| 1.2.2 | 25 | 10/07/2026 |
| 1.2.1 | 68 | 12/12/2025 |
| 1.2.0 | 55 | 12/11/2025 |
| 1.1.1 | 31 | 10/06/2026 |
| 1.1.0 | 33 | 10/05/2026 |
| 1.0.3 | 46 | 12/15/2025 |
| 1.0.2 | 23 | 10/06/2026 |
| 1.0.1 | 28 | 09/30/2026 |
| 1.0.0 | 62 | 12/11/2025 |