Export (0) Print
Expand All

Contract.Assert Method (Boolean)

Checks for a condition; if the condition is false, follows the escalation policy set for the analyzer.

Namespace:  System.Diagnostics.Contracts
Assemblies:   mscorlib (in mscorlib.dll)
  System.Diagnostics.Contracts (in System.Diagnostics.Contracts.dll)

[<ConditionalAttribute("DEBUG")>]
[<ConditionalAttribute("CONTRACTS_FULL")>]
static member Assert : 
        condition:bool -> unit

Parameters

condition
Type: System.Boolean

The conditional expression to test.

The default escalation policy is to notify the attached debugger about a contract failure or to display an Assert dialog box if a debugger is not attached. Optionally, the analyzer can be instructed to throw an exception.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft