Assert Method (Boolean)
Collapse the table of content
Expand the table of content

Contract.Assert Method (Boolean)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

'Declaration
<ConditionalAttribute("DEBUG")> _
<ConditionalAttribute("CONTRACTS_FULL")> _
Public Shared Sub Assert ( _
	condition As Boolean _
)

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.

Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft