Ensure.That 7.0.0-pre38

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.

This is a prerelease version of Ensure.That.
There is a newer version of this package available.
See the version list below for details.
Install-Package Ensure.That -Version 7.0.0-pre38
dotnet add package Ensure.That --version 7.0.0-pre38
<PackageReference Include="Ensure.That" Version="7.0.0-pre38" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ensure.That --version 7.0.0-pre38
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Using static simple methods

EnsureArg.IsNotNullOrWhiteSpace(myString);
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));

the value is passed through so that you e.g. can assign it to a field:

_field1 = EnsureArg.IsNotNullOrWhiteSpace(myString);
_field2 = EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));

Samples

The Samples above just uses string validation, but there are more. E.g.:

  • Strings
  • Numerics
  • Collections (arrays, lists, collections, dictionaries)
  • Booleans
  • Guids

Turn On/Off - default is On

Could be used with different profiles. Like Debug and CI is On while Release is Off.

#if RELEASE
    Ensure.Off()
#endif

Using static simple methods

EnsureArg.IsNotNullOrWhiteSpace(myString);
EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));

the value is passed through so that you e.g. can assign it to a field:

_field1 = EnsureArg.IsNotNullOrWhiteSpace(myString);
_field2 = EnsureArg.IsNotNullOrWhiteSpace(myString, nameof(myArg));

Samples

The Samples above just uses string validation, but there are more. E.g.:

  • Strings
  • Numerics
  • Collections (arrays, lists, collections, dictionaries)
  • Booleans
  • Guids

Turn On/Off - default is On

Could be used with different profiles. Like Debug and CI is On while Release is Off.

#if RELEASE
    Ensure.Off()
#endif

Release Notes

https://github.com/danielwertheim/Ensure.That/blob/feature-v7/ReleaseNotes.md

  • .NETFramework 4.5.1

    • No dependencies.
  • .NETStandard 1.1

  • .NETStandard 2.0

    • No dependencies.

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
tugberkugurlu/AspNetCore.Identity.MongoDB
MongoDB Data Store Adaptor for ASP.NET Core Identity
danielwertheim/mycouch
MyCouch is the asynchronous CouchDB client for .NET

Version History

Version Downloads Last updated
8.1.1 255,617 1/7/2019
8.1.0 41,446 11/10/2018
8.0.0 259,739 4/29/2018
8.0.0-pre78 386 2/17/2018
8.0.0-pre71 281 2/14/2018
7.2.1 58,029 12/29/2017
7.2.0 16,416 12/14/2017
7.1.0 14,691 11/19/2017
7.1.0-pre50 417 11/15/2017
7.0.0 2,954 11/9/2017
7.0.0-pre43 421 11/9/2017
7.0.0-pre38 413 11/9/2017
7.0.0-pre37 419 10/31/2017
7.0.0-pre32 2,761 10/16/2017
7.0.0-pre24 412 9/27/2017
6.0.1 11,284 10/4/2017
6.0.1-pre28 252 10/3/2017
6.0.0 9,101 9/19/2017
6.0.0-pre18 299 9/14/2017
6.0.0-pre16 316 9/10/2017
6.0.0-pre15 283 9/10/2017
6.0.0-pre12 272 9/9/2017
6.0.0-pre11 322 9/7/2017
5.0.0 171,463 10/8/2016
5.0.0-b3 722 10/5/2016
4.0.0 106,940 11/24/2015
3.3.0 1,412 11/10/2015
3.2.0 1,965 9/28/2015
3.1.1 810 9/19/2015
3.1.0 1,855 8/30/2015
3.0.0 1,114 8/22/2015
2.0.0 27,532 7/2/2014
1.0.0 4,504 7/10/2013
Show less