My favorites | Sign in
Project Logo
             
Search
for
Updated Mar 16, 2008 by gael.fraiteur
DesignByContract  

DesignByContract lets you specify constraint and checks to your code.

Introduction

You can find an introduction to design by contract here.

Details

Current features:

Usage

Download source code from svn repository. Built it and copy Torch.DesignByContract.dll, Torch.DesignByContract.Weaver.dll and Torch.DesignByContract.psplugin to the PlugIns directory under the PostSharp installation location. Reference Torch.DesignByContract.dll from your project.

NonNull/NonEmpty

  [return: NonNull] public SomeObject SomeMethod([NonNull] AnotherObject param1)
  {
    ...
  }

Singleton

Declaration

  [Singleton]
  public class MySingletonCandidate
  {
     // default constructor
     public MySingletonCandidate()
     {
        ...
     }
     ...
  }

Using the class

Just like any other class, if you are compiling against the plain class (not yet enhaced)
  MySingletonCandidate obj1 = new MySingletonCandidate();
Or
  MySingletonCandidate obj1 = MySingletonCandidate.Instance;
If you are compiling against the enhaced class.

Comments to altobarba at gmail dot com, or posting in the postsharp's forum.

Ignacio Vivona.


Sign in to add a comment
Hosted by Google Code