views:

185

answers:

2

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

+2  A: 

I've heard Jon Skeet's covering them in the next C# in Depth, but it's not out yet.

Joel Coehoorn
+2  A: 

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.

Ahmad Mageed
In fact you don't need to buy it to get a (slightly old) version of chapter 15 - go to the link in the post and it's a freely downloadable chapter :)
Jon Skeet
@Jon thanks for pointing that out :)
Ahmad Mageed