Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata