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 (optional; String)

String to output if booleanExpression is False


string2 (optional; String)

Additional detail text to output if booleanExpression is False

Description

The Assert method outputs messages to the debug listeners if a condition fails.

Usage at a Glance

  • Assert is typically used to test an expression that should evaluate to true.

  • The Debug class features only work in the design-time environment; the statement has no effect in a compiled application. You do not have to remove Debug-related features from your code before release.

  • If neither string is supplied, the current call stack is output on failure.

Version Differences

The .NET Assert method is similar to the VB 6 method of the same name, except that the .NET version displays a message if an expression is False, while the VB 6 version suspends program execution.

See Also

Debug Class




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

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