Class
Guard

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:

cs-api-definition
public static class Guard

Inheritance: objectGuard

Methods

Assert(bool, string)

Asserts the specified condition.

Declaration

cs-api-definition
public static void Assert(bool condition, string message)

Parameters

condition

bool

The condition.

message

string

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

cs-api-definition
public static void ThrowExceptionIfContainsNull<T>(IEnumerable<T> param, string paramName) where T : class

Parameters

param

IEnumerable<T>

The parameter.

paramName

string

Name of the parameter.

ThrowExceptionIfContainsNullOrEmpty(IEnumerable<string>, string)

Throws an exception if the parameter contains null or empty values.

Declaration

cs-api-definition
public static void ThrowExceptionIfContainsNullOrEmpty(IEnumerable<string> param, string paramName)

Parameters

param

IEnumerable<string>

The parameter.

paramName

string

Name of the parameter.

ThrowExceptionIfGreaterThan<T>(T, T, string)

Throws an exception if the parameters is greater than the upper bound.

Declaration

cs-api-definition
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

string

Name of the parameter.

ThrowExceptionIfInvalidColumnIndex(int)

Throws an exception if the column index is invalid.

Declaration

cs-api-definition
public static void ThrowExceptionIfInvalidColumnIndex(int columnIndex)

Parameters

columnIndex

int

Index of the column.

ThrowExceptionIfInvalidRowIndex(int)

Throws an exception if the row index is invalid.

Declaration

cs-api-definition
public static void ThrowExceptionIfInvalidRowIndex(int rowIndex)

Parameters

rowIndex

int

Index of the row.

ThrowExceptionIfLessThan<T>(T, T, string)

Throws an exception if the parameter is less than the lower bound.

Declaration

cs-api-definition
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

string

Name of the parameter.

ThrowExceptionIfNotEqual<T>(T, T, string)

Throws an exception if the parameter is not equal to a value.

Declaration

cs-api-definition
public static void ThrowExceptionIfNotEqual<T>(T expected, T param, string paramName)

Parameters

expected

T

The expected value.

param

T

The parameters.

paramName

string

Name of the parameter.

ThrowExceptionIfNotNull<T>(T, string)

Throws an exception if the parameter is not null.

Declaration

cs-api-definition
public static void ThrowExceptionIfNotNull<T>(T param, string paramName)

Parameters

param

T

The parameter.

paramName

string

Name of the parameter.

ThrowExceptionIfNull<T>(T, string)

Throws an exception if the parameter is null.

Declaration

cs-api-definition
public static void ThrowExceptionIfNull<T>(T param, string paramName)

Parameters

param

T

The parameter.

paramName

string

Name of the parameter.

ThrowExceptionIfNullOrEmpty(string, string)

Throws the exception if the parameter is null or empty.

Declaration

cs-api-definition
public static void ThrowExceptionIfNullOrEmpty(string param, string paramName)

Parameters

param

string

The parameter.

paramName

string

Name of the parameter.

ThrowExceptionIfNullOrEmpty<T>(IEnumerable<T>, string)

Throws an exception if the parameter is null or empty.

Declaration

cs-api-definition
public static void ThrowExceptionIfNullOrEmpty<T>(IEnumerable<T> param, string paramName) where T : class

Parameters

param

IEnumerable<T>

The parameter.

paramName

string

Name of the parameter.

ThrowExceptionIfOutOfRange<T>(T, T, T, string)

Throws an exception if out of range.

Declaration

cs-api-definition
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

string

Name of the parameter.