This documentation is archived and is not being maintained.
System.Diagnostics.Contracts Namespace
Visual Studio 2010
Contains static classes for representing program contracts such as preconditions, postconditions, and invariants.
| Class | Description | |
|---|---|---|
![]() | Contract | Contains static methods for representing program contracts such as preconditions, postconditions, and object invariants. |
![]() | ContractClassAttribute | Specifies that a separate type contains the code contracts for this type. |
![]() | ContractClassForAttribute | Specifies that a class is a contract for a type. |
![]() | ContractFailedEventArgs | Provides methods and data for the Contract::ContractFailed event. |
![]() | ContractInvariantMethodAttribute | Marks a method as being the invariant method for a class. |
![]() | ContractPublicPropertyNameAttribute | Specifies that a field can be used in method contracts when the field has less visibility than the method. |
![]() | ContractReferenceAssemblyAttribute | Specifies that an assembly is a reference assembly that contains contracts. |
![]() | ContractRuntimeIgnoredAttribute | Identifies a member that has no run-time behavior. |
![]() | ContractVerificationAttribute | Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification. |
![]() | PureAttribute | Indicates that a type or method is pure, that is, it does not make any visible state changes. |
| Enumeration | Description | |
|---|---|---|
![]() | ContractFailureKind | Specifies the type of contract that failed. |
Show:

