Ensure.That 8.1.2

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.2
dotnet add package Ensure.That --version 8.1.2
<PackageReference Include="Ensure.That" Version="8.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ensure.That --version 8.1.2
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/releases

Showing the top 5 GitHub repositories that depend on Ensure.That:

Repository Stars
tidusjar/Ombi
Want a Movie or TV Show on Plex or Emby? Use Ombi!
asc-lab/dotnetcore-microservices-poc
Very simplified insurance sales system made in a microservices architecture using .NET Core
microsoft/fhir-server
A service that implements the FHIR standard
danielwertheim/mycouch
MyCouch is the asynchronous CouchDB client for .NET
tugberkugurlu/AspNetCore.Identity.MongoDB
MongoDB Data Store Adaptor for ASP.NET Core Identity

Read more about the GitHub Usage information on our documentation.

Version History

Version Downloads Last updated
8.1.2 19,808 11/15/2019
8.1.1 337,018 1/7/2019
8.1.0 46,949 11/10/2018
8.0.0 292,980 4/29/2018
8.0.0-pre78 433 2/17/2018
8.0.0-pre71 327 2/14/2018
7.2.1 62,292 12/29/2017
7.2.0 17,013 12/14/2017
7.1.0 15,430 11/19/2017
7.1.0-pre50 544 11/15/2017
7.0.0 3,191 11/9/2017
7.0.0-pre43 551 11/9/2017
7.0.0-pre38 553 11/9/2017
7.0.0-pre37 542 10/31/2017
7.0.0-pre32 3,105 10/16/2017
7.0.0-pre24 486 9/27/2017
6.0.1 12,115 10/4/2017
6.0.1-pre28 297 10/3/2017
6.0.0 9,520 9/19/2017
6.0.0-pre18 344 9/14/2017
6.0.0-pre16 364 9/10/2017
6.0.0-pre15 330 9/10/2017
6.0.0-pre12 317 9/9/2017
6.0.0-pre11 376 9/7/2017
5.0.0 181,144 10/8/2016
5.0.0-b3 964 10/5/2016
4.0.0 116,654 11/24/2015
3.3.0 1,452 11/10/2015
3.2.0 2,024 9/28/2015
3.1.1 849 9/19/2015
3.1.0 1,901 8/30/2015
3.0.0 1,161 8/22/2015
2.0.0 27,805 7/2/2014
1.0.0 4,584 7/10/2013