System.Diagnostics.Contracts
Contains static methods for representing program contracts such as preconditions, postconditions, and object invariants.
Checks for a condition; if the condition is false, follows the escalation policy set for the analyzer.
The conditional expression to test.
Checks for a condition; if the condition is false, follows the escalation policy set by the analyzer and displays the specified message.
The conditional expression to test.
A message to display if the condition is not met.
Instructs code analysis tools to assume that the specified condition is true, even if it cannot be statically proven to always be true.
The conditional expression to assume true.
Instructs code analysis tools to assume that a condition is true, even if it cannot be statically proven to always be true, and displays a message if the assumption fails.
The conditional expression to assume true.
The message to post if the assumption fails.
Occurs when a contract fails.
Marks the end of the contract section when a method's contracts contain only preconditions in the if-then-throw form.
Specifies a postcondition contract for the enclosing method or property.
The conditional expression to test. The expression may include , , and values.
Specifies a postcondition contract for a provided exit condition and a message to display if the condition is false.
The conditional expression to test. The expression may include and values.
The message to display if the expression is not true.
Specifies a postcondition contract for the enclosing method or property, based on the provided exception and condition.
The conditional expression to test.
The type of exception that invokes the postcondition check.
Specifies a postcondition contract and a message to display if the condition is false for the enclosing method or property, based on the provided exception and condition.
The conditional expression to test.
The message to display if the expression is false.
The type of exception that invokes the postcondition check.
Determines whether an element within a collection of elements exists within a function.
true if and only if returns true for any element of type in .
The collection from which elements of type will be drawn to pass to .
The function to evaluate for an element in .
The type that is contained in .
or is null.
Determines whether a specified test is true for any integer within a range of integers.
true if returns true for any integer starting from to - 1.
The first integer to pass to .
One more than the last integer to pass to .
The function to evaluate for any value of the integer in the specified range.
is null.
is less than .
Determines whether all the elements in a collection exist within a function.
true if and only if returns true for all elements of type in .
The collection from which elements of type will be drawn to pass to .
The function to evaluate for the existence of all the elements in .
The type that is contained in .
or is null.
Determines whether a particular condition is valid for all integers in a specified range.
true if returns true for all integers starting from to - 1.
The first integer to pass to .
One more than the last integer to pass to .
The function to evaluate for the existence of the integers in the specified range.
is null.
is less than .
Specifies an invariant contract for the enclosing method or property.
The conditional expression to test.
Specifies an invariant contract for the enclosing method or property, and displays a message if the condition for the contract fails.
The conditional expression to test.
The message to display if the condition is false.
Represents values as they were at the start of a method or property.
The value of the parameter or field at the start of a method or property.
The value to represent (field or parameter).
The type of value.
Specifies a precondition contract for the enclosing method or property, and throws an exception if the condition for the contract fails.
The conditional expression to test.
The exception to throw if the condition is false.
Specifies a precondition contract for the enclosing method or property.
The conditional expression to test.
Specifies a precondition contract for the enclosing method or property, and displays a message if the condition for the contract fails.
The conditional expression to test.
The message to display if the condition is false.
Specifies a precondition contract for the enclosing method or property, and throws an exception with the provided message if the condition for the contract fails.
The conditional expression to test.
The message to display if the condition is false.
The exception to throw if the condition is false.
Represents the return value of a method or property.
Return value of the enclosing method or property.
Type of return value of the enclosing method or property.
Represents the final (output) value of an out parameter when returning from a method.
The output value of the out parameter.
The out parameter.
The type of the out parameter.
Defines abbreviations that you can use in place of the full contract syntax.
Initializes a new instance of the class.
Enables the factoring of legacy if-then-throw code into separate methods for reuse, and provides full control over thrown exceptions and arguments.
Initializes a new instance of the class.
Specifies that a separate type contains the code contracts for this type.
Initializes a new instance of the class.
The type that contains the code contracts for this type.
Gets the type that contains the code contracts for this type.
The type that contains the code contracts for this type.
Specifies that a class is a contract for a type.
Initializes a new instance of the class, specifying the type the current class is a contract for.
The type the current class is a contract for.
Gets the type that this code contract applies to.
The type that this contract applies to.
Provides methods and data for the event.
Provides data for the event.
One of the enumeration values that specifies the contract that failed.
The message for the event.
The condition for the event.
The exception that caused the event.
Gets the condition for the failure of the contract.
The condition for the failure.
Gets the type of contract that failed.
One of the enumeration values that specifies the type of contract that failed.
Indicates whether the event has been handled.
true if the event has been handled; otherwise, false.
Gets the message that describes the event.
The message that describes the event.
Gets the original exception that caused the event.
The exception that caused the event.
Sets the property to true.
Sets the property to true.
Indicates whether the code contract escalation policy should be applied.
true to apply the escalation policy; otherwise, false. The default is false.
Specifies the type of contract that failed.
An contract failed.
An contract failed.
An contract failed.
An contract failed.
An contract failed.
A contract failed.
Marks a method as being the invariant method for a class.
Initializes a new instance of the class.
Enables you to set contract and tool options at assembly, type, or method granularity.
Initializes a new instance of the class by using the provided category, setting, and enable/disable value.
The category for the option to be set.
The option setting.
true to enable the option; false to disable the option.
Initializes a new instance of the class by using the provided category, setting, and value.
The category of the option to be set.
The option setting.
The value for the setting.
Gets the category of the option.
The category of the option.
Determines if an option is enabled.
true if the option is enabled; otherwise, false.
Gets the setting for the option.
The setting for the option.
Gets the value for the option.
The value for the option.
Specifies that a field can be used in method contracts when the field has less visibility than the method.
Initializes a new instance of the class.
The property name to apply to the field.
Gets the property name to be applied to the field.
The property name to be applied to the field.
Specifies that an assembly is a reference assembly that contains contracts.
Initializes a new instance of the class.
Identifies a member that has no run-time behavior.
Initializes a new instance of the class.
Instructs analysis tools to assume the correctness of an assembly, type, or member without performing static verification.
Initializes a new instance of the class.
true to require verification; otherwise, false.
Gets the value that indicates whether to verify the contract of the target.
true if verification is required; otherwise, false.
Indicates that a type or method is pure, that is, it does not make any visible state changes.
Initializes a new instance of the class.
Provides methods that the binary rewriter uses to handle contract failures.
Used by the binary rewriter to activate the default failure behavior.
A null reference (Nothing in Visual Basic) if the event was handled and should not trigger a failure; otherwise, returns the localized failure message.
One of the enumeration values that specifies the type of failure.
Additional user information.
The description of the condition that caused the failure.
The inner exception that caused the current exception.
is not a valid value.
Triggers the default failure behavior.
One of the enumeration values that specifies the type of failure.
The message to display.
Additional user information.
The description of the condition that caused the failure.
The inner exception that caused the current exception.