While System.Diagnostics.Contracts
is included within the .Net Framework. To use Code Contracts you must install the Visual Studio extensions.
Under Extensions and Updates
search for Code Contracts
then install the Code Contracts Tools
After the tools are installed you must enable Code Contracts
within your Project solution. At the minimum you probably want to enable the Static Checking
(check after build). If you are implementing a library that will be used by other solutions you may want to consider also enabling Runtime Checking
.