 | ContractRequiresTException Method (Boolean, String) |
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: Slash.Diagnostics.ContractsAssembly: Slash.Diagnostics (in Slash.Diagnostics.dll) Version: 1.0.6018.40181
Syntaxpublic static void Requires<TException>(
bool condition,
string userMessage
)
where TException : Exception
Public Shared Sub Requires(Of TException As Exception) (
condition As Boolean,
userMessage As String
)
public:
generic<typename TException>
where TException : Exception
static void Requires(
bool condition,
String^ userMessage
)
static member Requires :
condition : bool *
userMessage : string -> unit when 'TException : Exception
Parameters
- condition
- Type: SystemBoolean
The conditional expression to test. - userMessage
- Type: SystemString
The message to display if the condition is false.
Type Parameters
- TException
- The exception to throw if the condition is false.
See Also