Microsoft DevLabs turned their Spec# Project into Code Contracts, which offers design-by-contract funcationality for .NET Languages.
Per the website:
"Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs. The contracts take the form of pre-conditions, post-conditions, and object invariants. Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation. Code Contracts bring the advantages of design-by-contract programming to all .NET programming languages."
Code Contracts integrates with Visual Studio 2008 and does a bit of IL weaving to inject the contract code into your applications in a language agnostic way.
Code Contracts uses a library using calls like Contract.Requires for pre-conditions and Contract.Ensures for post-conditions, etc.
Code could look like something below where Code Contracts checks to verify productId is not zero. Simple example I know ;)
public Product FetchProductById(int productId)
{
Contract.Requires(productId != 0);
// ...
}
Learn more here.
Check-out Soma's blog, too.