code合同,你会使用它们呢? [英] Code Contracts, will you use them?

查看:168
本文介绍了code合同,你会使用它们呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

微软刚刚发布了 code合同的,一个工具,集成了Visual Studio和允许您定义合约的净code和获得运行时的的编译时检查。

Microsoft just released Code Contracts, a tool that integrates with Visual Studio and allows you to define contracts for your .Net code and get runtime and compile time checking.

观看<一href="http://channel9.msdn.com/posts/Peli/Getting-started-with-$c$c-Contracts-in-Visual-Studio-2008/"相对=nofollow>视频频道9 ,显示它被如何使用。

Watch the video on Channel 9 that shows how it being used.

现在它是一个附加的,但它会在.NET 4.0中的基类库的一部分

For now it's an add-on but it will be part of the Base Class Library in .Net 4.0

这是不是你看到自己使用?

Is this something you see yourself using?

我不知道这意味着规格#死亡?

I wonder if this means the death of Spec#?

更新

我的意思的规格#的死亡是,我们现在有2个不同的项目写入合同:
规格#是C#的演进,它引入了新的关键字和行为;另一方面,微软刚刚发布的是,可以与任何.NET语言中使用的库。
由于后者看起来像它会成为事实上的标准,我不知道在那里留下规格#

What I mean by the death of Spec# is that we now have 2 different projects for writing contracts:
Spec# is an evolution of C# and it introduces new keywords and behaviours; on the other hand, what Microsoft just released is a library that can be used with any .Net language.
Since the latter looks like it's going to become the de-facto standard, I wonder where that leaves Spec#

推荐答案

我想创建计划公开给任何人一个库时,大部分使用C#4.0将使用他们自己的开发列入特别。它可以让你的code更详细的领域,但它的优点应该超过了code和花费的时间线。

I think the majority of developers using c# 4.0 will use them myself included especially when creating a library that you plan to expose to anyone. It may make your code more verbose in areas but the advantages it has should outweigh the lines of code and time spent.

这篇关于code合同,你会使用它们呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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