4.14. Code Contracts
Code contracts are a method for expressing constraints and assumptions within your code. They allow specification of complex rules that can be validated at both compile time and runtime. Code contracts are also supported in VS2008.
NOTE
Compile-time or static verification is available only in the Premium and Ultimate editions of Visual Studio. This is a real shame because it will probably prevent widespread adoption of this great technology rather than encouraging users to purchase a more expensive edition of Visual Studio (similar to MSTest and VS2005?). Hopefully this will not be permanent, and you will see static verification available in all future versions of Visual Studio.
In addition to providing validation, code ...
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.
Read now
Unlock full access