May 2010
Intermediate to advanced
1272 pages
61h 18m
English
A post-condition is a contract that is checked after code is executed and is basically used to check the result of some code execution. Continuing with the previous example, you might want to check that the CalculatePerimeter method produces a value greater than zero before returning the result. This kind of post-condition is accomplished via the Contracts.Ensures method, as demonstrated in the following snippet:

Also notice how Ensures invokes Contract.Result(Of T). This is basically the representation of the code result, and T is nothing but the expected type, which in this case is Double. This line of code must be placed before ...
Read now
Unlock full access