Guard
Provides methods for checking whether the parameters of methods fall within the expected conditions.
Definition
Namespace:Telerik.Documents.Spreadsheet.Utilities
Assembly:Telerik.Windows.Documents.Spreadsheet.dll
Syntax:
public static class Guard
Inheritance: objectGuard
Methods
Throws an exception if the parameter contains null values.
public static void ThrowExceptionIfContainsNull<T>(IEnumerable<T> param, string paramName) where T : class
The parameter.
paramNamestringName of the parameter.
Throws an exception if the parameter contains null or empty values.
public static void ThrowExceptionIfContainsNullOrEmpty(IEnumerable<string> param, string paramName)
The parameter.
paramNamestringName of the parameter.
Throws an exception if the parameters is greater than the upper bound.
public static void ThrowExceptionIfGreaterThan<T>(T upperBound, T param, string paramName) where T : IComparable<T>
The upper bound.
paramTThe parameter.
paramNamestringName of the parameter.
Throws an exception if the column index is invalid.
public static void ThrowExceptionIfInvalidColumnIndex(int columnIndex)
Index of the column.
Throws an exception if the row index is invalid.
public static void ThrowExceptionIfInvalidRowIndex(int rowIndex)
Index of the row.
Throws an exception if the parameter is less than the lower bound.
public static void ThrowExceptionIfLessThan<T>(T lowerBound, T param, string paramName) where T : IComparable<T>
The lower bound.
paramTThe parameter.
paramNamestringName of the parameter.
Throws an exception if the parameter is not equal to a value.
public static void ThrowExceptionIfNotEqual<T>(T expected, T param, string paramName)
The expected value.
paramTThe parameters.
paramNamestringName of the parameter.
Throws an exception if the parameter is not null.
public static void ThrowExceptionIfNotNull<T>(T param, string paramName)
The parameter.
paramNamestringName of the parameter.
Throws an exception if the parameter is null.
public static void ThrowExceptionIfNull<T>(T param, string paramName)
The parameter.
paramNamestringName of the parameter.
Throws an exception if the parameter is null or empty.
public static void ThrowExceptionIfNullOrEmpty<T>(IEnumerable<T> param, string paramName) where T : class
The parameter.
paramNamestringName of the parameter.
Throws an exception if out of range.
public static void ThrowExceptionIfOutOfRange<T>(T lowerBound, T upperBound, T param, string paramName) where T : IComparable<T>
The lower bound.
upperBoundTThe upper bound.
paramTThe parameter.
paramNamestringName of the parameter.