You are previewing C# in Depth, Second Edition.

C# in Depth, Second Edition

Cover of C# in Depth, Second Edition by Jon Skeet Published by Manning Publications

Chapter 15. Letting your code speak more clearly with Code Contracts

This chapter covers

  • The objectives of Code Contracts
  • Writing contracts in your code
  • Binary rewriting
  • Static checking
  • Contract documentation
  • Applying contracts

This book is about C#, the language. I haven’t attempted to cover the whole of the .NET framework or even just the Base Class Library (BCL). Apart from when we were looking at different LINQ providers in chapter 12, I’ve been rigidly focused on explaining the features introduced in each version of C#. This chapter is somewhat different. It’s not about a new ability of the language itself, but a combination of tools and types (collectively called Code Contracts) that can radically change your code’s appearance and ...

The best content for your career. Discover unlimited learning on demand for around $1/day.