Contract Methods

Contract Methods

.NET Framework (current version)
 

Namespace:   System.Diagnostics.Contracts
Assembly:  mscorlib (in mscorlib.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAssert(Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticAssert(Boolean, String)

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

System_CAPS_pubmethodSystem_CAPS_staticAssume(Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticAssume(Boolean, 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.

System_CAPS_pubmethodSystem_CAPS_staticEndContractBlock()

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

System_CAPS_pubmethodSystem_CAPS_staticEnsures(Boolean)

Specifies a postcondition contract for the enclosing method or property.

System_CAPS_pubmethodSystem_CAPS_staticEnsures(Boolean, String)

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

System_CAPS_pubmethodSystem_CAPS_staticEnsuresOnThrow<TException>(Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticEnsuresOnThrow<TException>(Boolean, 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.

System_CAPS_pubmethodSystem_CAPS_staticExists(Int32, Int32, Predicate<Int32>)

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

System_CAPS_pubmethodSystem_CAPS_staticExists<T>(IEnumerable<T>, Predicate<T>)

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

System_CAPS_pubmethodSystem_CAPS_staticForAll(Int32, Int32, Predicate<Int32>)

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

System_CAPS_pubmethodSystem_CAPS_staticForAll<T>(IEnumerable<T>, Predicate<T>)

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

System_CAPS_pubmethodSystem_CAPS_staticInvariant(Boolean)

Specifies an invariant contract for the enclosing method or property.

System_CAPS_pubmethodSystem_CAPS_staticInvariant(Boolean, String)

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

System_CAPS_pubmethodSystem_CAPS_staticOldValue<T>(T)

Represents values as they were at the start of a method or property.

System_CAPS_pubmethodSystem_CAPS_staticRequires(Boolean)

Specifies a precondition contract for the enclosing method or property.

System_CAPS_pubmethodSystem_CAPS_staticRequires(Boolean, String)

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

System_CAPS_pubmethodSystem_CAPS_staticRequires<TException>(Boolean)

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

System_CAPS_pubmethodSystem_CAPS_staticRequires<TException>(Boolean, 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.

System_CAPS_pubmethodSystem_CAPS_staticResult<T>()

Represents the return value of a method or property.

System_CAPS_pubmethodSystem_CAPS_staticValueAtReturn<T>(T)

Represents the final (output) value of an out parameter when returning from a method.

Return to top
Show:
© 2016 Microsoft