Click to expand
Sandcastle XML Comments Guide

Code Contract Elements

The Code Contracts Library created by Microsoft contains a tool (ccdocgen) that can be ran after a build to insert contract XML documentation elements into the XML comments file for an assembly.

Important note Important
The Code Contracts Library contains an outdated patch to several Sandcastle presentation style files. Since code contracts element support is built into the latest release of the presentation styles, do not apply this patch.

Below is a list of the elements that the tool may insert into each member. Refer to the Code Contracts user manual for more information (section 8 at the time this topic was written).

ElementDescription
ensuresMay appear under method elements, property getters, and property setters. The element body is the string of the original postcondition.
ensuresOnThrowMay appear under method elements, property getters, and property setters. The element body is the string of the original exceptional postcondition.
invariantMay appear under classes. The element body is the string of the original invariant.
pureMay appear under methods marking them as pure. No additional information is present.
requiresMay appear under method elements, property getters, and property setters. The element body is the string of the original precondition.
See Also

Other Resources