Debug.Assert Method

   
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.

   


VB.Net Language in a Nutshell
VB.NET Language in a Nutshell
ISBN: B00006L54Q
EAN: N/A
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net