A new Code Contracts preview is now available on DevLabs. Code Contracts will be part of the base class library in .NET 4.0 (included in mscorlib), and facilitate a Design by Contract programming approach. You can describe pre-conditions, post-conditions, and object invariants. The Code Let’s borrow a couple ideas from Matt’s DbC post (he was using Spec#, which was a precursor) to see what Code Contracts will look like. public void Run()
{
TargetResult result = LaunchMissle(new Target());
}
public TargetResult LaunchMissle(Target target)
{
Contract.Requires(target != null);
Contract.Ensures(Contract.Result<TargetResult>() != null);
return...