ContractRequiresTException Method (Boolean, String, String) |
[This is preliminary documentation and is subject to change.]
Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
Namespace:
Umbrace.Unity.Contracts
Assembly:
Umbrace.Unity.PurePool (in Umbrace.Unity.PurePool.dll) Version: 0.0.0.0 (1.0.0.0)
Syntax[ConditionalAttribute("CONTRACTS_REQUIRES_E")]
[ConditionalAttribute("CONTRACTS_FULL")]
public static void Requires<TException>(
bool condition,
string message,
string memberName = null
)
where TException : new(), Exception
Parameters
- condition
- Type: SystemBoolean
The conditional expression to test. - message
- Type: SystemString
The message to display if the condition is . - memberName (Optional)
- Type: SystemString
Type Parameters
- TException
- The exception to throw if the condition is .
See Also