Code Contracts
Code contracts provide a way to specify
preconditions-- Requirements that must be met when entering a method or property
postconditions-- Expectations at the time the method or property code exits.
and object invariants in your code.-- The expected state for a class that is in a good state.
for pre , post condition contracts,
Runtime Contract Check, Static Contract Check are done as project settings
for object invariant contracts
They are set as attributes at class/interface/base class / abstract class level too.for pre , post condition contracts,
related tools : visit some of following tools
Ccrewrite.exe
Cccheck.exe
Ccdoc.exe
Ccrefgen.exe