Class ThrowIf
- Namespace
- Glitch9
Validate objects and throw exceptions when a condition is not met.
public class ThrowIf
- Inheritance
-
ThrowIf
- Inherited Members
- Extension Methods
Methods
ArgumentIsNull(object, string)
Throws ArgumentNullException if the value is null.
public static void ArgumentIsNull(object value, string paramName)
Parameters
Exceptions
ArgumentIsNull(params (object value, string name)[])
public static void ArgumentIsNull(params (object value, string name)[] values)
Parameters
ArgumentIsNull<T>(T)
Throws ArgumentNullException if the value is null.
public static void ArgumentIsNull<T>(T value)
Parameters
valueTThe value to check.
Type Parameters
TThe type of the value.
Exceptions
CollectionIsNullOrEmpty<T>(ICollection<T>, string)
public static void CollectionIsNullOrEmpty<T>(ICollection<T> collection, string collectionName = "Collection")
Parameters
collectionICollection<T>collectionNamestring
Type Parameters
T
EndpointIsNull(string, string)
public static void EndpointIsNull(string value, string endpointName = "Endpoint")
Parameters
InsufficientCurrency(float, float, string)
public static void InsufficientCurrency(float balance, float amount, string currencyName = "Funds")
Parameters
IsDefault<T>(T, string)
public static void IsDefault<T>(T value, string paramName)
Parameters
valueTparamNamestring
Type Parameters
T
IsLessThanZero(decimal, string)
public static void IsLessThanZero(decimal value, string paramName)
Parameters
IsLessThanZero(double, string)
public static void IsLessThanZero(double value, string paramName)
Parameters
IsLessThanZero(int, string)
public static void IsLessThanZero(int value, string paramName)
Parameters
IsLessThanZero(long, string)
public static void IsLessThanZero(long value, string paramName)
Parameters
IsLessThanZero(float, string)
public static void IsLessThanZero(float value, string paramName)
Parameters
IsNullOrEmpty(string, string)
Throws ArgumentNullException if the string is null or empty.
public static void IsNullOrEmpty(string value, string paramName)
Parameters
Exceptions
IsNullOrEmpty<T>(ICollection<T>, string)
public static void IsNullOrEmpty<T>(ICollection<T> value, string paramName)
Parameters
valueICollection<T>paramNamestring
Type Parameters
T
IsNullOrWhitespace(string, string)
Throws ArgumentNullException if the string is null or whitespace.
public static void IsNullOrWhitespace(string value, string paramName)
Parameters
Exceptions
ListIsNullOrEmpty<T>(IList<T>, string)
public static void ListIsNullOrEmpty<T>(IList<T> array, string arrayName = "Array")
Parameters
Type Parameters
T
ResultIsNull<T>(T)
public static void ResultIsNull<T>(T result)
Parameters
resultT
Type Parameters
T