Contract.Requires Method

 
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.

Specifies a precondition contract for an enclosing method or property.

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

NameDescription
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.

Return to top
Show: