A universal polyfill library that provides modern ArgumentNullException.ThrowIf* and ArgumentException.ThrowIf* helper methods across all .NET runtimes (.NET Standard 2.0+, .NET Framework 4.6.2+, .NET 6.0+), enabling consistent argument validation patterns regardless of target framework version.
$ dotnet add package NetEvolve.ArgumentsProvides a set of backward compatible argument throw helper methods added in the latest .NET versions.
Especially intended for projects with multiple TargetFrameworks, for usage, standardization and maintainability.
The following methods are currently provided.
Compatibility method to ArgumentOutOfRangeException.ThrowIfGreaterThan<T>(T, T, String), which was introduced with .NET 8
Compatibility method to ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual<T>(T, T, String), which is part of the framework since .NET 8.
Compatibility method to ArgumentOutOfRangeException.ThrowIfLessThan<T>(T, T, String), which is part of the framework since .NET 8.
Compatibility method to ArgumentOutOfRangeException.ThrowIfLessThanOrEqual<T>(T, T, String), which is part of the framework since .NET 8.
Compatibility method to ArgumentNullException.ThrowIfNull(Object, String), which is part of the framework since .NET 8.
Compatibility method to ArgumentException.ThrowIfNullOrEmpty(String, String), which is part of the framework since .NET 8.
Compatibility method to ArgumentException.ThrowIfNullOrWhiteSpace(String, String), which is part of the framework since .NET 8.