StaticDotNet.ArgumentValidation 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package StaticDotNet.ArgumentValidation --version 0.1.0
NuGet\Install-Package StaticDotNet.ArgumentValidation -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StaticDotNet.ArgumentValidation" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StaticDotNet.ArgumentValidation --version 0.1.0
#r "nuget: StaticDotNet.ArgumentValidation, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StaticDotNet.ArgumentValidation as a Cake Addin
#addin nuget:?package=StaticDotNet.ArgumentValidation&version=0.1.0

// Install StaticDotNet.ArgumentValidation as a Cake Tool
#tool nuget:?package=StaticDotNet.ArgumentValidation&version=0.1.0

Why should I use this

StaticDotNet.ArgumentValiation is a guard library with performance, nullability and ease of use in mind. Guard clauses should be clean and focus on performance when exceptions don't happen. In a perfect application, which we all know developers write 100% of the time, guard clauses take up CPU time, which is why they should be focused on being fast.

This is what validation is for

Validation is focused on the end user, guard clauses are focused on developers. This is a big difference and why guard clauses are still important. The point of a guard clause is to prevent a developer from doing something that will always result in an issue with the application. Validation is focused on helping the end user accomplish a specific work flow based on the business requirements while adhering to the limitations of the application. Both are important, but serve completely different purposes.

Nullability annotations makes guard clauses pointless

While nullability annontations is a huge step forward in help us developers write better applications, which as I stated earlier we don't need as we get it right 100% of the time, it doesn't replace the need for guard clauses.

  • First those only help us address those dreaded "Object reference not set to an instance of an object" exceptions. If you haven't had to look at the stack trace, open a method of over 100 lines of code and tried to figure out what could possible be null in some randome situation, you haven't lived.
  • Second, and this is especially important for libraries, they can be turned off. And even if they aren't turned off, the number of times I have seen developers ignore those warnings just amazes me. Not you of course, you are one of the good developers, hence why you are here.
  • And third, nullability annotations only help with checking for null. It doesn't help with the other issues that developers face in ensuring the parameters are valid.

Writing guard clauses are ugly

Yes, writing guard clauses are ugly and they take up a lot of space. That is why this library exists. We all agree they are important but they take up too many lines of code and are ugly. Ok, maybe you don't agree, yet, but drink the Kool-Aid and I promise not space ships are involved. That is one of the key points of this library is so they aren't so ugly and take up lines of code. One of the things I have learned with coding is that developers want to do the right thing, but if it involves a lot of boiler plate code, they skip it. This library is built with developers in mind to make it quick and easy to write simple, performant guard clauses.

Supported Frameworks

The library is also build with trying to support as many versions of the .NET framework that are currently supported by Microsoft.

  • .NET Standard 2.0
  • .NET Standard 2.1
  • .NET 6.0
  • .NET 7.0
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.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
1.0.0 494 11/16/2023
0.6.5 637 7/31/2023
0.6.4 662 5/30/2023
0.6.3 663 5/29/2023
0.6.2 618 5/25/2023
0.6.1 653 5/19/2023
0.6.0 651 5/2/2023
0.5.3 670 4/7/2023
0.5.2 805 1/6/2023
0.5.1 797 12/22/2022
0.5.0 774 12/21/2022
0.4.0 795 12/20/2022
0.3.0 794 12/16/2022
0.2.0 777 12/16/2022
0.1.0 798 12/8/2022