Code contracts
Code contracts provide a way to specify preconditions, postconditions, and object invariants.
- Preconditions are requirements that must be met when entering a method or property.
- Postconditions describe expectations at the time the method or property code exits.
- Object invariants describe the expected state for a class that is in a good state.
- source