
.NET 4.0 Code Contracts and Validation Overview" (58 characters)
Explore the implementation of .NET 4.0 Code Contracts, including preconditions, postconditions, static analysis, invariants, and interface contracts. Learn how these tools offer enhanced validation capabilities for developers. Discover the benefits of using Microsoft's System.Diagnostics.Contracts API and tools. (288 characters)
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
.NET 4.0 Code Contracts About Me James Newton-King Developer at Intergen Blog: http://james.newtonking.com
.NET 4.0 Code Contracts Agenda Validation today Introduction to Code Contracts Preconditions & Postconditions Static Analysis Invariants Interface Contracts The Future
.NET 4.0 Code Contracts Validation today Typical validation...
.NET 4.0 Code Contracts What is wrong with validation today? Ad-hoc No way to get validation rules metadata Runtime only
.NET 4.0 Code Contracts Introduction to Code Contracts New API + tools from Microsoft System.Diagnostics.Contracts MSIL rewriting Inspired by Spec# Included in .NET 4.0 but download available now for .NET 3.5 and VS2008 http://research.microsoft.com/en-us/projects/contracts/
.NET 4.0 Code Contracts Preconditions & Postconditions Preconditions Argument validation Contract.Requires Contract.RequiresAlways Contract.EndContractBlock Postconditions Return validation Contract.Ensures Contract.Result<T> Demo!
.NET 4.0 Code Contracts Static Analysis Compile time analysis of your code! Visual Studio Team System only : ( Good Visual Studio integration Demo!
.NET 4.0 Code Contracts Invariants Invariants Validation of object state Contract.Invariant Demo!
.NET 4.0 Code Contracts Interface Contracts You can define contracts against an interface Preconditions and postconditions inherited Implementers are warned if they don t follow the contract But how does that work? Contracts are defined in implementation...? ContractClassAttribute to the rescue! Demo!
.NET 4.0 Code Contracts Timelines Out now Code Contracts for VS2008 preview VS2010 Beta 1 Coming up Ongoing VS2008 updates VS2010 Beta 2 Year End VS2008, VS2010 final (hopefully)
.NET 4.0 Code Contracts The Future! Entire .NET Framework marked up with contract metadata Documentation generated from contracts Hopefully an API to get contract rules UI validation using code contracts And more
.NET 4.0 Code Contracts Questions Ask now, Ask me later, Or email me: james@newtonking.com Slides Blog: http://james.newtonking.com