Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="4.0.0" />

 Shield

public static class Shield
Represents a utility class for input validation.
public static void EnsureGreaterThan(int actual, int reference)

Checks two integers and throws an ArgumentException if the actual is lesser than the reference.

public static void EnsureNotNull<T>(Expression<Func<T>> memberExpression)

Checks the value of the given object and throws an ArgumentNullException if it == null.

public static void EnsureNotNull<T>(T obj, string parameterName)

Checks the value of the given object and throws an ArgumentNullException if it == null.

public static void EnsureNotNull<T>(Expression<Func<T>> memberExpression, string message)

Checks the value of the given object and throws an ArgumentNullException with the given message if it == null.

public static void EnsureNotNull<T>(T obj, string parameterName, string message)

Checks the value of the given object and throws an ArgumentNullException with the given message if it == null.

public static void EnsureNotNullOrEmpty(Expression<Func<string>> memberExpression)

Checks the value of the given string and throws an ArgumentException if it == null or empty.

public static void EnsureNotNullOrEmpty(string obj, string parameterName)

Checks the value of the given string and throws an ArgumentException if it == null or empty.

public static void EnsureTrue(bool condition, string message)

Checks a bool condition and throws an ArgumentException if it is false.

public static void EnsureTypeOf<TType>(object obj)

Checks the type of the given object and throws an ArgumentException if it doesn't matches with the given type parameter.