有关 C# 4.0 中的代码契约的书籍
尽管我已经了解代码契约有一段时间了,因为我在 Java 中使用过它,但我想开始在 C# 中使用它们,现在它们是 C# 4.0 的一部分。
我正在寻找学习材料、书籍或视频。尽管教程也很受欢迎,但我希望有一些全面的内容可供阅读,而不是典型的“这是您如何使用 Requires,这是您如何使用 Ensures”。我正在寻找在这个领域真正脱颖而出的东西。
谢谢
Altough I've known Code Contracts for some time, as I've used it a bit in Java, I would like to start using them in C#, now that they are part of C# 4.0.
I am looking on learning material, books or vids. Altough tutorials are also welcome, I'd like to have something comprehensive to read, not the typical "here's how you use Requires and here's how you use Ensures". I am looking for something that really stands out in this area.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Jon Skeet 在C# in Depth第二版中专门用了整整一章来介绍它们。根据上次 MEAP 更新,大约有 40 页。这还不是最终版本,因为正如 Joel 提到的,它还没有发布,但您可以购买它并访问 MEAP 版本:http://www.manning.com/skeet2/
C# 4.0 简而言之 在第 1 章中介绍了它。 13,“诊断和代码合同”。根据目录中的章节标题,我估计该主题大约有 17 页。
我想象 Andrew Troelsen 的Pro C# 2010 和 .NET 4 平台 书会介绍它,但我找不到它的目录。
Jon Skeet has an entire chapter dedicated to them in the 2nd edition of C# in Depth. It's roughly 40 pages based on the last MEAP update. This isn't final since, as Joel mentioned, it's not out yet, but you could buy it and get access to the MEAP releases: http://www.manning.com/skeet2/
C# 4.0 in a Nutshell covers it in Ch. 13, "Diagnostics and Code Contracts." Based on the chapter headings in the table of contents I estimate ~17 pages on the topic.
I imagine Andrew Troelsen's Pro C# 2010 and the .NET 4 Platform book will cover it, but I wasn't able to find a TOC for it.
我听说 Jon Skeet 在下一本书《C# 深度剖析》中介绍了它们,但它还没有出版。
I've heard Jon Skeet's covering them in the next C# in Depth, but it's not out yet.
虽然不是真正的书,但可通过Code Contracts 软件下载的官方文档是不错。
对于具体问题,您可以使用官方代码契约论坛。开发人员似乎反应相当灵敏。
顺便一提:
我的理解是代码契约不是 C# 4.0 的一部分。相反,它们是 .NET 4.0 BCL 的一部分,并可作为 .NET 3.5 的单独程序集使用。 .NET 4.0 和 3.5 都要求您安装额外的软件才能使用合约。
Though not really a book, the official documentation downloadable with the Code Contracts software is pretty good.
For specific questions, you can use the official Code Contracts forum. The developers seem to be pretty responsive.
By the way:
My understanding is that Code Contracts are not part of C# 4.0. Rather, they are part of the .NET 4.0 BCL and available as a separate assembly for .NET 3.5. Both .NET 4.0 and 3.5 requiere you to install additional software to use the contracts.