Many.Validators 4.0.0

.NET 6.0 .NET Standard 2.1 .NET Framework 4.7.2
Install-Package Many.Validators -Version 4.0.0
dotnet add package Many.Validators --version 4.0.0
<PackageReference Include="Many.Validators" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Many.Validators --version 4.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Many.Validators, 4.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Many.Validators as a Cake Addin
#addin nuget:?package=Many.Validators&version=4.0.0

// Install Many.Validators as a Cake Tool
#tool nuget:?package=Many.Validators&version=4.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


A set of very-easy-to-read immutable types to add seamless validations in your projects.

Focused on:

  • Less documentation, better code legibility.
  • No extra line of code, just change type by validators and that's all.
  • Minimum overhead compared to traditional copy-pasted-conditionals way or any other implementation.

👉Download releases at


  • Roadmap
  • Features
    • Two-way conversion between validator and underlying types
    • Seamless integration
    • InRange validators
    • Concatenation clauses
    • Multiple explicit validations
    • NetStandard 2.1 and NET60 specific implementations


Validator Implemented Version
NotNull<> ✅ 1.0.0
NotNullOrEmpty< string> ✅ 1.0.0
NotNullOrEmptyArray<> ✅ 1.1.0
Positive<> ✅ 1.0.0
PositiveOrZero<> ✅ 1.0.0
Negative<> ✅ 1.0.0
NegativeOrZero<> ✅ 1.0.0
InRange<> ✅ 2.0.0
GreaterThan<> ❌
LowerThan<> ❌
NotDefault<> ❌
Feature Implemented Version
Multiple explicit validation ✅ 3.0.0
Concatenation clause (All) ✅ 4.0.0


✅ Two-way conversion between validator and underlying types

NotNull<string> notNullStringValidator = "whatever"; //Ok
string x = notNullStringValidator; //Ok

notNullStringValidator.Equals(x); //true!

✅ Seamless integration

Use validators in your methods referring your underlying type:

bool DoSomething(NotNull<string> @param)
    //@param is observed and validated when is instantiated. 
    //If validation fails no line of code will be run in this method

    //Gets @param value with no conversion
    return !string.IsNullOrWhiteSpace(@param); 

And call your methods as usual with no additional conversions:

string p;

<Code where you can assign a value to p or not...>

var result = WhateverMethod(p);

<Continues if no exception was raised...>

✅ InRange validators

InRange validators need a range 😅. To get that you only need to create your custom range class (inherited from abstract RangeBase class) and implement the abstract properties. Finally be sure to name your class with a self-descritive name.


namespace YourProject.Validators.Ranges.Int64
    internal class Neg100_1 : Range<Int64>
        public override long Max => 1;

        public override long Min => -100;

Then only use it:

public void DoSometing(InRange<Neg100_1, Int64> param1) 

Tip: Also you can follow a self-descriptive namespace naming strategy in order to get clearer shorter range names.

✅ Concatenation clauses

You can concatenate 2 or 3 validators using clauses (they are placed in different namespaces depending on number of validators: Many.Validators.Clauses.S2 and S3):

using Many.Validators.Clauses.S2;

public void DoSometing(All<NotNull<int?>, Positive<int?>, int?> param1) 


using Many.Validators.Clauses.S3;

public void DoSometing(All<NotNull<int?>, Positive<int?>, InRange<Int_1_100, int?>, int?> param1) 

✅ Multiple explicit validations

Also you can validate multiple values in a explicit way. If you have a class like this:

class YourObject
    public string Id {get;set;}
    public string Data {get;set;}

You can validate itself and properties' values in several ways:

public void DoSomething(NotNull<YourObject> param) //This line checks if param itself is not null
    var otherParamsToCheck = new string[]{param.Id, param.Data};

    //You can validate params and get an exception if any of them is not valid or...

    // can validate params and get the whole result with no exceptions

    //1.Get all errors
    var result = NotNull<string>.IsValid(otherParamsToCheck, out string[] errors);

    //2.Get and stop after first error
    result = NotNull<string>.IsValid(otherParamsToCheck, out string error);    

✅ NetStandard 2.1 and NET60 specific implementations

  • New Half type support for NET5 and NET6 projects.
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
.NET Framework net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • All Frameworks

  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 90 2/18/2022
3.0.0 79 1/18/2022
2.0.0 118 1/2/2022
2.0.0-beta1 106 1/2/2022
1.1.0 118 12/27/2021
1.0.4 145 12/21/2021
1.0.3 111 12/21/2021

- Added: Concatenation clause All (support 2 and 3 validators)
- Added: Multiple explicit validations
- Added: InRange validator
- Added: NotNullOrEmpty(string) and NotNullOrEmptyArray
- NotNull, NotEmpty, Positive, PositiveOrZero, Negative and NegativeOrZero validators.