Tech Off Post

Single Post Permalink

View Thread: Design by Contract in C#
  • User profile image

    Charles said:
    Bass said:

    The C# compiler has not been modified to support design by contract, right? This is a library implementation. But I could be wrong...

    Contracts is simply an API. The Code Contracts project from MSR (see link above) provides tools that leverage these 'annotations' (runtime instrumentation, static checker, documentation generation). All the tools works at the MSIL level and, thus, are language agnostic. Code Contracts should work for any .net language (module bugs in the decompiler).


    In the future, it will be up to the language designers to integrate contracts, similarly to the foreach statement in C#.