Class Guard
Provides methods for checking whether the parameters of methods fall within the expected conditions.
Inheritance
Inherited Members
Namespace: Telerik.Windows.Documents.Spreadsheet.Utilities
Assembly: Telerik.Windows.Documents.Spreadsheet.dll
Syntax
public static class Guard
Methods
Assert(Boolean, String)
Asserts the specified condition.
Declaration
public static void Assert(bool condition, string message)
Parameters
System.Boolean
condition
The condition. |
System.String
message
The message to throw in case the condition is not met. |
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
System.Collections.Generic.IEnumerable<T>
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type 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
System.Collections.Generic.IEnumerable<System.String>
param
The parameter. |
System.String
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
T
upperBound
The upper bound. |
T
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type of the parameter. |
ThrowExceptionIfInvalidColumnIndex(Int32)
Throws an exception if the column index is invalid.
Declaration
public static void ThrowExceptionIfInvalidColumnIndex(int columnIndex)
Parameters
System.Int32
columnIndex
Index of the column. |
ThrowExceptionIfInvalidRowIndex(Int32)
Throws an exception if the row index is invalid.
Declaration
public static void ThrowExceptionIfInvalidRowIndex(int rowIndex)
Parameters
System.Int32
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
T
lowerBound
The lower bound. |
T
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type 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
T
expected
The expected value. |
T
param
The parameters. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type of the parameters. |
ThrowExceptionIfNotNull<T>(T, String)
Throws an exception if the parameter is not null.
Declaration
public static void ThrowExceptionIfNotNull<T>(T param, string paramName)
Parameters
T
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type 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
T
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type of the parameter. |
ThrowExceptionIfNullOrEmpty(String, String)
Throws the exception if the parameter is null or empty.
Declaration
public static void ThrowExceptionIfNullOrEmpty(string param, string paramName)
Parameters
System.String
param
The parameter. |
System.String
paramName
Name of the parameter. |
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
System.Collections.Generic.IEnumerable<T>
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type 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
T
lowerBound
The lower bound. |
T
upperBound
The upper bound. |
T
param
The parameter. |
System.String
paramName
Name of the parameter. |
Type Parameters
T
The type of the parameters. |