 | ContractRequiresTException Method (Boolean, Object) |
Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided parameters if the condition for the contract fails.
Namespace: Slash.Diagnostics.ContractsAssembly: Slash.Diagnostics (in Slash.Diagnostics.dll) Version: 1.0.6018.40181
Syntaxpublic static void Requires<TException>(
bool condition,
params Object[] args
)
where TException : Exception
Public Shared Sub Requires(Of TException As Exception) (
condition As Boolean,
ParamArray args As Object()
)
public:
generic<typename TException>
where TException : Exception
static void Requires(
bool condition,
... array<Object^>^ args
)
static member Requires :
condition : bool *
args : Object[] -> unit when 'TException : Exception
Parameters
- condition
- Type: SystemBoolean
The conditional expression to test. - args
- Type: SystemObject
Arguments to create exception from.
Type Parameters
- TException
- The exception to throw if the condition is false.
See Also