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