如果您使用Visual Studio 2010并且使用.net framework 4.0，则在项目属性中可以看到Code Contracts这个选项，Code Contracts源自于Design By Contract，由于Desing By Contract已经被Eiffel注册，因此我想微软就换个名称叫Code Contracts，而其思想却来自于Deisgn By Contract，我今天终于找到了这本七年前由人民邮电出版社出版的《Desing By Contract 原则和实践》书。
I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. In recent years, a number of program analysers like PREfix and PREfast in Microsoft have been used to check references, and give warnings if there is a risk they may be non-null. More recent programming languages like Spec# have introduced declarations for non-null references. This is the solution, which I rejected in 1965.