Ensure.That 8.1.1

Argument validation made simple and unified. It ensures arguments conforms to simple validation rules and provides an uniformed exception throwing strategy if arguments are invalid.

Install-Package Ensure.That -Version 8.1.1
dotnet add package Ensure.That --version 8.1.1
<PackageReference Include="Ensure.That" Version="8.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ensure.That --version 8.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Using extension methods

Ensure.That(myString).IsNotNullOrWhiteSpace();
Ensure.That(myString, nameof(myArg)).IsNotNullOrWhiteSpace();
Ensure.That(myString, nameof(myArg), opts => opts.WithMessage("Foo")).IsNotNullOrWhiteSpace();

Using contextual validation

Ensure.String.IsNotNullOrWhiteSpace(myString);
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg));
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));

Using static simple methods

EnsureArg.IsNotNullOrWhiteSpace(myString);
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));

Using extension methods

Ensure.That(myString).IsNotNullOrWhiteSpace();
Ensure.That(myString, nameof(myArg)).IsNotNullOrWhiteSpace();
Ensure.That(myString, nameof(myArg), opts => opts.WithMessage("Foo")).IsNotNullOrWhiteSpace();

Using contextual validation

Ensure.String.IsNotNullOrWhiteSpace(myString);
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg));
Ensure.String.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));

Using static simple methods

EnsureArg.IsNotNullOrWhiteSpace(myString);
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg), opts => opts.WithMessage("Foo"));

Release Notes

https://github.com/danielwertheim/ensure.that/blob/master/ReleaseNotes.md

  • .NETFramework 4.5.1

    • No dependencies.
  • .NETStandard 1.1

  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
8.1.1 61,946 1/7/2019
8.1.0 24,298 11/10/2018
8.0.0 176,351 4/29/2018
8.0.0-pre78 317 2/17/2018
8.0.0-pre71 208 2/14/2018
7.2.1 49,009 12/29/2017
7.2.0 15,231 12/14/2017
7.1.0 12,606 11/19/2017
7.1.0-pre50 261 11/15/2017
7.0.0 2,533 11/9/2017
7.0.0-pre43 251 11/9/2017
7.0.0-pre38 252 11/9/2017
7.0.0-pre37 255 10/31/2017
7.0.0-pre32 2,155 10/16/2017
7.0.0-pre24 318 9/27/2017
6.0.1 9,931 10/4/2017
6.0.1-pre28 204 10/3/2017
6.0.0 7,045 9/19/2017
6.0.0-pre18 208 9/14/2017
6.0.0-pre16 236 9/10/2017
6.0.0-pre15 203 9/10/2017
6.0.0-pre12 205 9/9/2017
6.0.0-pre11 232 9/7/2017
5.0.0 149,566 10/8/2016
5.0.0-b3 365 10/5/2016
4.0.0 86,773 11/24/2015
3.3.0 1,345 11/10/2015
3.2.0 1,860 9/28/2015
3.1.1 739 9/19/2015
3.1.0 1,776 8/30/2015
3.0.0 1,038 8/22/2015
2.0.0 26,664 7/2/2014
1.0.0 4,362 7/10/2013