This library provides a number of extension methods that allow standard checks such as null check, empty check, range check an so on, do be done in one single line of code. Note, the latest version includes **breaking changes**.
$ dotnet add package Plexdata.Utilities.ExceptionsThis library provides a number of extension methods that allow standard checks such as null check, empty check, range check an so on, do be done in one single line of code.
Every extension method comes with a set of overloads that allow to control the name of affected parameter and the exception's message as well as the type of the exception to be thrown.
Here is an overview of all existing extension methods that are provided by this package, including their default exceptions:
ThrowIfNull() is used for any kind of null check and throws an ArgumentNullException as default.ThrowIfNotVerified(delegate) and ThrowIfNotVerified(delegate(value)) are used for any kind of object
validation and throw an ArgumentVerifyException as default.ThrowIfNullOrEmpty() and ThrowIfNullOrWhiteSpace() are used especially for string checks and throw
an ArgumentOutOfRangeException as default.ThrowIfEqualTo(other) and ThrowIfNotEqualTo(other) are used for any kind of equal checks and throw an
ArgumentOutOfRangeException as default.
IEquatable<T>.ThrowIfLessThan(minimum) and ThrowIfLessThanOrEqualTo(minimum) are used for lower limit checks and
throw an ArgumentOutOfRangeException as default.
IComparable<T>.ThrowIfGreaterThan(maximum) and ThrowIfGreaterThanOrEqualTo(maximum) are used for upper limit checks
and throw an ArgumentOutOfRangeException as default.
IComparable<T>.ThrowIfOutOfRange(minimum, maximum) is used for range checks and throws an ArgumentOutOfRangeException as default.
IComparable<T>.The sources can be found on GitHub under https://github.com/akesseler/Plexdata.Utilities.Exceptions.
The class documentation can be found on GitHub under https://github.com/akesseler/Plexdata.Utilities.Exceptions/wiki.
The documentation with an overview, an introduction as well as examples is available on the project page.