![]() |
VOOZH | about |
dotnet add package StaticDotNet.ArgumentValidation --version 1.0.0
NuGet\Install-Package StaticDotNet.ArgumentValidation -Version 1.0.0
<PackageReference Include="StaticDotNet.ArgumentValidation" Version="1.0.0" />
<PackageVersion Include="StaticDotNet.ArgumentValidation" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="StaticDotNet.ArgumentValidation" />Project file
paket add StaticDotNet.ArgumentValidation --version 1.0.0
#r "nuget: StaticDotNet.ArgumentValidation, 1.0.0"
#:package StaticDotNet.ArgumentValidation@1.0.0
#addin nuget:?package=StaticDotNet.ArgumentValidation&version=1.0.0Install as a Cake Addin
#tool nuget:?package=StaticDotNet.ArgumentValidation&version=1.0.0Install as a Cake Tool
StaticDotNet.ArgumentValiation is a nullability annotation supported fluent guard library with performance and ease of use in mind.
Supports:
Package can install via NuGet and can be found at https://www.nuget.org/packages/StaticDotNet.ArgumentValidation.
While nullability annontations is a huge step forward in helping us developers write better applications (which we don't need as we get it right 100% of the time), it doesn't replace the need for guard clauses. And most of the guard libraries aren't able to fully support nullability annotations, which means you have to constantly ignore those warnings which really makes nullability annotations less helpful. And without them you have a bigger chance of getting the fun "Object not set to an instance of an object" error. If you haven't had to look at the stack trace, open a method of over 500 lines of code and tried to figure out what could possible be null in some random situation, you haven't lived.
If you are writing libraries that other developers/applications are using, your code has no way of knowing if nullability annontations are turned on. Or worse case those warnings are just ignored anyway. Not you of course, you are one of the good developers, hence why you are here.
Lastly nullability annotations only help with checking for null. It doesn't help with the other requirements that parameters have.
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.
Since the point of guard clauses are to ensure the developer doesn't write bad code, ideally they should never throw an exception. This library is built around the idea that it should be just as fast as possible and avoid allocating any memory with the idea that the exception will not happen.
It also uses a readonly ref struct so as much as possible stays on the stack without copying the struct on every call.
The library includes the specific attributes and analyzers to ensure it can be trimmed. This allows you to only include the validations that are used within you application when you enable trimming.
Yes, writing guard clauses are ugly and they take up a lot of space. 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 no space ships are involved.
The library is built using fluent syntax as that allows the developer a lot of flexibility with how they want to combine different argument validation. It is also built to only show the available validation methods for the specific argument type.
All documentation can be found at here.
0.5.1
0.5.2
0.5.3
0.6.0
0.6.1
0.6.2
0.6.3
0.6.4
0.6.5
1.0.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 666 | 11/16/2023 |
| 0.6.5 | 827 | 7/31/2023 |
| 0.6.4 | 835 | 5/30/2023 |
| 0.6.3 | 842 | 5/29/2023 |
| 0.6.2 | 805 | 5/25/2023 |
| 0.6.1 | 833 | 5/19/2023 |
| 0.6.0 | 826 | 5/2/2023 |
| 0.5.3 | 846 | 4/7/2023 |
| 0.5.2 | 996 | 1/6/2023 |
| 0.5.1 | 974 | 12/22/2022 |
| 0.5.0 | 963 | 12/21/2022 |
| 0.4.0 | 973 | 12/20/2022 |
| 0.3.0 | 978 | 12/16/2022 |
| 0.2.0 | 961 | 12/16/2022 |
| 0.1.0 | 995 | 12/8/2022 |
See README for release notes.