Ministry.FluentGuard 1.0.2

Parameter checking extension methods

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

This project provides simple extension methods for handling argument validation in a fluent form.

Examples

Here's some examples of how it can be used...

public void MyMethod(object param1)
{
    param1.ThrowIfNull(nameof(param1));     
}

public void MyMethod(string param1)
{
    param1.ThrowIfNullOrEmpty(nameof(param1));    
}

It is fully fluent, returning the original object, allowing methods like this...

public int Increment(int? param1)
    => param1.ThrowIfNull(nameof(param1)) + 1;

Available Methods

The following fluent error checkas are available along with the exceptions they can generate (depedning on the value)...

  • ThrowIfNull - ArgumentNullException
  • ThrowIfNullOrEmpty - ArgumentNullException / ArgumentException
  • ThrowIf - ArgumentException
  • ThrowOutOfRangeIf - ArgumentOutOfRangeException

The Ministry of Technology Open Source Products

Welcome to The Ministry of Technology open source products. All open source Ministry of Technology products are distributed under the MIT License for maximum re-usability. Details on more of our products and services can be found on our website at http://www.minotech.co.uk

Our other open source repositories can be found here...

Where can I get it?

You can download the package for this project from any of the following package managers...

Contribution guidelines

If you would like to contribute to the project, please contact me.

Who do I talk to?

  • Keith Jackson - keith@minotech.co.uk

This project provides simple extension methods for handling argument validation in a fluent form.

Examples

Here's some examples of how it can be used...

public void MyMethod(object param1)
{
    param1.ThrowIfNull(nameof(param1));     
}

public void MyMethod(string param1)
{
    param1.ThrowIfNullOrEmpty(nameof(param1));    
}

It is fully fluent, returning the original object, allowing methods like this...

public int Increment(int? param1)
    => param1.ThrowIfNull(nameof(param1)) + 1;

Available Methods

The following fluent error checkas are available along with the exceptions they can generate (depedning on the value)...

  • ThrowIfNull - ArgumentNullException
  • ThrowIfNullOrEmpty - ArgumentNullException / ArgumentException
  • ThrowIf - ArgumentException
  • ThrowOutOfRangeIf - ArgumentOutOfRangeException

The Ministry of Technology Open Source Products

Welcome to The Ministry of Technology open source products. All open source Ministry of Technology products are distributed under the MIT License for maximum re-usability. Details on more of our products and services can be found on our website at http://www.minotech.co.uk

Our other open source repositories can be found here...

Where can I get it?

You can download the package for this project from any of the following package managers...

Contribution guidelines

If you would like to contribute to the project, please contact me.

Who do I talk to?

  • Keith Jackson - keith@minotech.co.uk

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.2 449 10/27/2018
1.0.1 436 5/9/2018
1.0.0 207 3/21/2018