System.Diagnostics.Contracts Namespace

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

The System.Diagnostics.Contracts namespace contains static classes for representing program contracts such as preconditions, postconditions, and invariants.

ClassDescription
System_CAPS_pubclassContract

Contains static methods for representing program contracts such as preconditions, postconditions, and object invariants.

System_CAPS_pubclassContractAbbreviatorAttribute

Defines abbreviations that you can use in place of the full contract syntax.

System_CAPS_pubclassContractArgumentValidatorAttribute

Enables the factoring of legacy if-then-throw code into separate methods for reuse, and provides full control over thrown exceptions and arguments.

System_CAPS_pubclassContractClassAttribute

Specifies that a separate type contains the code contracts for this type.

System_CAPS_pubclassContractClassForAttribute

Specifies that a class is a contract for a type.

System_CAPS_pubclassContractFailedEventArgs

Provides methods and data for the Contract.ContractFailed event.

System_CAPS_pubclassContractInvariantMethodAttribute

Marks a method as being the invariant method for a class.

System_CAPS_pubclassContractOptionAttribute

Enables you to set contract and tool options at assembly, type, or method granularity.

System_CAPS_pubclassContractPublicPropertyNameAttribute

Specifies that a field can be used in method contracts when the field has less visibility than the method.

System_CAPS_pubclassContractReferenceAssemblyAttribute

Specifies that an assembly is a reference assembly that contains contracts.

System_CAPS_pubclassContractRuntimeIgnoredAttribute

Identifies a member that has no run-time behavior.

System_CAPS_pubclassContractVerificationAttribute

Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification.

System_CAPS_pubclassPureAttribute

Indicates that a type or method is pure, that is, it does not make any visible state changes.

EnumerationDescription
System_CAPS_pubenumContractFailureKind

Specifies the type of contract that failed.

Return to top
Show: