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 |
---|
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).
Element |
Description |
---|---|
ensures |
May appear under method elements, property getters, and property setters. The element body is the string of the original postcondition. |
ensuresOnThrow |
May appear under method elements, property getters, and property setters. The element body is the string of the original exceptional postcondition. |
invariant |
May appear under classes. The element body is the string of the original invariant. |
pure |
May appear under methods marking them as pure. No additional information is present. |
requires |
May appear under method elements, property getters, and property setters. The element body is the string of the original precondition. |