通缉:代码合约的真实世界范例 [英] Wanted: Real world example of Code Contracts

查看:48
本文介绍了通缉:代码合约的真实世界范例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有一个真实的例子,使用契约式设计和特别是代码合同?

Does anyone has a real world example of using Design by Contract and particularly Code contracts ?

我可以使用简单的if来确保对象不是null但是我想看一个更多  complected 现实世界验证的例子...

i could use a simple if to make sure object is not null but i'd like to see an example of more complected real world verifications...

 谢谢!

Dan

推荐答案

大多数基类库现在都有合同,可能是一个很好的起点。安装编辑器扩展,在查看类详细信息时显示合同。  可能一个好的起点是IList,因为它突出了前
和后期条件。
Most of the base class libraries now have contracts and are probably a good place to start. Install the editor extension that shows you the contracts when you view class details.  Probably a good place to start is IList as it highlight the both pre and post conditions.


这篇关于通缉:代码合约的真实世界范例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆