System.Diagnostics.Contracts.Contract.Assume Method

Instructs code analysis tools to assume that a condition is true, even if it cannot be statically proven to always be true, and displays a message if the assumption fails.

Syntax

[System.Diagnostics.Conditional("DEBUG")]
[System.Diagnostics.Conditional("CONTRACTS_FULL")]
[System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)]
public static void Assume (bool condition, string userMessage)

Parameters

condition
The conditional expression to assume true.
userMessage
The message to post if the assumption fails.

Remarks

If userMessage is not a constant string literal, the contract may not be understood by tools.

At run time, using this method is equivalent to using the Contract.Assert(bool, string) method.

Requirements

Namespace: System.Diagnostics.Contracts
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0