Assertions and Assumptions

The Contract class provides an Assert method that is used for verifying a condition at a particular point in the program execution. Typically you use it as follows:

Contract.Assert(Width > 0)

There is also another method named Assume, which works exactly like Assert but is used when static verification is not sufficient to prove the condition you are attempting to check.

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.