Contract.Requires usage

前端 未结 3 1723
梦如初夏
梦如初夏 2020-12-24 05:26

Here is my problem. I am a very big fan of Design by contract, I am using this concept especially when developing libraries that can be used by other developers. I just foun

3条回答
  •  渐次进展
    2020-12-24 05:46

    From the Contract class docs:

    Important

    You must install a Visual Studio add-in to enforce contracts. The Code Contracts Premium Edition add-in lets you specify static and run-time checking of code contracts on the project Properties page. If you do not enable run-time checking, contracts such as the Contract.Ensures method will not throw exceptions during run time if a contract is violated. The Visual Studio add-in does not ship with Visual Studio 2010 or the Windows SDK.

提交回复
热议问题