Ensure.That 8.0.0-pre78

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.
Install-Package Ensure.That -Version 8.0.0-pre78
dotnet add package Ensure.That --version 8.0.0-pre78
paket add Ensure.That --version 8.0.0-pre78
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"));

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 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"));

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/master/ReleaseNotes.md

  • .NETFramework 4.5.1

    • No dependencies.
  • .NETStandard 1.1

  • .NETStandard 2.0

    • No dependencies.

Version History

Version Downloads Last updated
8.0.0 8,392 4/29/2018
8.0.0-pre78 (current) 155 2/17/2018
8.0.0-pre71 74 2/14/2018
7.2.1 27,629 12/29/2017
7.2.0 6,432 12/14/2017
7.1.0 8,709 11/19/2017
7.1.0-pre50 106 11/15/2017
7.0.0 1,780 11/9/2017
7.0.0-pre43 88 11/9/2017
7.0.0-pre38 88 11/9/2017
7.0.0-pre37 92 10/31/2017
7.0.0-pre32 1,058 10/16/2017
7.0.0-pre24 197 9/27/2017
6.0.1 5,843 10/4/2017
6.0.1-pre28 101 10/3/2017
6.0.0 4,464 9/19/2017
6.0.0-pre18 108 9/14/2017
6.0.0-pre16 122 9/10/2017
6.0.0-pre15 103 9/10/2017
6.0.0-pre12 101 9/9/2017
6.0.0-pre11 123 9/7/2017
5.0.0 105,092 10/8/2016
5.0.0-b3 178 10/5/2016
4.0.0 50,613 11/24/2015
3.3.0 1,198 11/10/2015
3.2.0 1,642 9/28/2015
3.1.1 632 9/19/2015
3.1.0 1,649 8/30/2015
3.0.0 933 8/22/2015
2.0.0 25,133 7/2/2014
1.0.0 3,946 7/10/2013