VB.NET Language in a Nutshell
| Debug.Assert Method |
Class
System.Diagnostics.Debug
Syntax
Debug .Assert( booleanexpression [[, string1 ], string2 ])
- booleanexpression (required; Boolean)
-
Expression that evaluates to a Boolean value.
- string1 (required; String)
-
String to output if booleanexpression is False .
- string2 (required; String)
-
Detailed string to output. If booleanexpression is False , string2 is output to Output window.
Return Value
None
Description
Outputs messages to the Output window if the condition is False
Rules at a Glance
booleanexpression must evaluate to a Boolean value.
Programming Tips and Gotchas
-
Assert is typically used when debugging to test an expression that should evaluate to True .
-
Debug.Assert executes only when an application is run in the design-time environment; the statement has no effect in a compiled application. This means that Debug.Assert will never produce a runtime error if the call to it is inappropriate, nor will it suspend program execution outside of the VB IDE. Because of this, you do not have to remove Debug.Assert statements from finished code or separate them with conditional #If...Then statements.