System.Diagnostics.Contracts.Contract: Method Members

The methods of System.Diagnostics.Contracts.Contract are listed below. For a list of all members, see the Contract Members list.

See Also: Inherited members from System.Object

Public Methods

static
Assert(bool)

Checks for a condition; if the condition is false, follows the escalation policy set for the analyzer.

static
Assert(bool, string)

Checks for a condition; if the condition is false, follows the escalation policy set by the analyzer and displays the specified message.

static
Assume(bool)

Instructs code analysis tools to assume that the specified condition is true, even if it cannot be statically proven to always be true.

static
Assume(bool, string)

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.

static
EndContractBlock()

Marks the end of the contract section when a method's contracts contain only preconditions in the if-then-throw form.

static
Ensures(bool)

Specifies a postcondition contract for the enclosing method or property.

static
Ensures(bool, string)

Specifies a postcondition contract for a provided exit condition and a message to display if the condition is false.

static
EnsuresOnThrow<TException>(bool)

Specifies a postcondition contract for the enclosing method or property, based on the provided exception and condition.

static
EnsuresOnThrow<TException>(bool, string)

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.

static
Exists(int, int, Predicate<int>) : bool

Determines whether a specified test is true for any integer within a range of integers.

static
Exists<T>(IEnumerable<T>, Predicate<T>) : bool

Determines whether an element within a collection of elements exists within a function.

static
ForAll(int, int, Predicate<int>) : bool

Determines whether a particular condition is valid for all integers in a specified range.

static
ForAll<T>(IEnumerable<T>, Predicate<T>) : bool

Determines whether all the elements in a collection exist within a function.

static
Invariant(bool)

Specifies an invariant contract for the enclosing method or property.

static
Invariant(bool, string)

Specifies an invariant contract for the enclosing method or property, and displays a message if the condition for the contract fails.

static
OldValue<T>(T) : T
Used within a postcondition to represent an initial value.
static
Requires(bool)

Specifies a precondition contract for the enclosing method or property.

static
Requires(bool, string)

Specifies a precondition contract for the enclosing method or property, and displays a message if the condition for the contract fails.

static
Requires<TException>(bool)

Specifies a precondition contract for the enclosing method or property, and throws an exception if the condition for the contract fails.

static
Requires<TException>(bool)
Specifies a precondition contract for when an exception is thrown.
static
Requires<TException>(bool)
Documentation for this section has not yet been entered.
static
Requires<TException>(bool)
Documentation for this section has not yet been entered.
static
Requires<TException>(bool, string)

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.

static
Requires<TException>(bool, string)
Documentation for this section has not yet been entered.
static
Requires<TException>(bool, string)
Specifies a precondition contract for when an exception is thrown.
static
Requires<TException>(bool, string)
Documentation for this section has not yet been entered.
static
Result<T>() : T

Represents the return value of a method or property.

static
ValueAtReturn<T>(out T) : T
Used within a postcondition to represent the final value of an out parameter.