End Contract Block Method
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Marks the end of the contract section when a method's contracts contain only preconditions in the
public: static void EndContractBlock();
[System.Diagnostics.Conditional("CONTRACTS_FULL")] public static void EndContractBlock ();
[<System.Diagnostics.Conditional("CONTRACTS_FULL")>] static member EndContractBlock : unit -> unit
Public Shared Sub EndContractBlock ()
Most code already contains some parameter validation in the form of
throw code. The contract tools recognize
throw statements as preconditions when the statements appear first inside a method, and the entire set of such statements is followed by an explicit Contract method call, such as a Requires, Ensures, EnsuresOnThrow, or EndContractBlock.
throw statements appear in this form, the contract tools recognize them as legacy-require statements. The EndContractBlock form is used only if no other contracts follow the
throw sequences, but they should still be tagged as legacy-requires.