C# Класс SharpFE.Guard

Guard provides a number of methods which check for bad variable states. This may include null parameters etc.. All methods of Guard will throw an exception on finding a bad variable.
Показать файл Открыть проект

Открытые методы

Метод Описание
AgainstBadArgument ( string parameterName, ArgumentComparator testForFailure, string failureMessage ) : void

Throws an exception if the testForFailure is true.

AgainstInvalidState ( ArgumentComparator testForFailure, string failureMessage ) : void

Throws an InvalidOperationException if the testForFailure is true

AgainstNullArgument ( object parameter, string parameterName ) : void

Throws an exception if the parameter is null.

AgainstNullArgument ( object parameter, string parameterName, string customErrorMessage ) : void

Throws an exception if the parameter is null.

Описание методов

AgainstBadArgument() публичный статический Метод

Throws an exception if the testForFailure is true.
public static AgainstBadArgument ( string parameterName, ArgumentComparator testForFailure, string failureMessage ) : void
parameterName string The name of the parameter within the calling method.
testForFailure ArgumentComparator A comparator which returns true if this method is to throw an error
failureMessage string A custom message to provide with the exception.
Результат void

AgainstInvalidState() публичный статический Метод

Throws an InvalidOperationException if the testForFailure is true
Thrown if the testForFailure returns true.
public static AgainstInvalidState ( ArgumentComparator testForFailure, string failureMessage ) : void
testForFailure ArgumentComparator A comparator which returnstrue if this method is to throw an InvalidOperationException
failureMessage string The message to include in the exception. This message is parsed using string.Format
Результат void

AgainstNullArgument() публичный статический Метод

Throws an exception if the parameter is null.
Thrown if the parameter is null.
public static AgainstNullArgument ( object parameter, string parameterName ) : void
parameter object The object to check is not null.
parameterName string The name of the parameter within the calling method.
Результат void

AgainstNullArgument() публичный статический Метод

Throws an exception if the parameter is null.
Thrown if the parameter is null.
public static AgainstNullArgument ( object parameter, string parameterName, string customErrorMessage ) : void
parameter object The object to check is not null.
parameterName string The name of the parameter within the calling method.
customErrorMessage string A custom error message.
Результат void