Results 1 to 2 of 2

Thread: Code Contracts for Visual Studio 2008/2010

  1. #1

    Thread Starter
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Code Contracts for Visual Studio 2008/2010

    Microsoft DevLabs “Code Contracts” is a tool for VS2008 and VS2010 which in short provides you with methods to ensure logic of your code is tighter by running diagnostics at compile time and runtime.

    Microsoft’s definition
    Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs. The contracts take the form of preconditions, postconditions, 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.

    I think that using contracts can greatly assist with writing tigher code along with your contract code may stay in the project and turned off in the project properties window. The best way to learn how to use contracts is by watching videos on the sites listed below or after installing contracts run the C# examples.


    On the web
    http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx
    http://research.microsoft.com/en-us/projects/contracts/

  2. #2
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Re: Code Contracts for Visual Studio 2008/2010

    I have downloaded a document, but I am not sure if code contracts are really useful to people who are just developing and maintaining code that was written in the early years of .NET.

    New projects might find it useful to implement code contracts.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width