Normally you would add reference to System.System.Diagnostics.Contracts to define your code contracts. To test it, here's how you do it.
Download Contract checker from the following url
Install it and then open your Visual Studio 2010, goto Project Explorer's Properties. You are able to locate "Code Contracts" you're good to go :)