RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(RuntimeHelpers+TryCode, RuntimeHelpers+CleanupCode, Object) Method

Definition

Executes code using a Delegate while using another Delegate to execute additional code in case of an exception.

public:
 static void ExecuteCodeWithGuaranteedCleanup(System::Runtime::CompilerServices::RuntimeHelpers::TryCode ^ code, System::Runtime::CompilerServices::RuntimeHelpers::CleanupCode ^ backoutCode, System::Object ^ userData);
[System.Security.SecurityCritical]
public static void ExecuteCodeWithGuaranteedCleanup (System.Runtime.CompilerServices.RuntimeHelpers.TryCode code, System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode backoutCode, object userData);
static member ExecuteCodeWithGuaranteedCleanup : System.Runtime.CompilerServices.RuntimeHelpers.TryCode * System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode * obj -> unit
Public Shared Sub ExecuteCodeWithGuaranteedCleanup (code As RuntimeHelpers.TryCode, backoutCode As RuntimeHelpers.CleanupCode, userData As Object)

Parameters

code
RuntimeHelpers.TryCode

A delegate to the code to try.

backoutCode
RuntimeHelpers.CleanupCode

A delegate to the code to run if an exception occurs.

userData
Object

The data to pass to code and backoutCode.

Attributes

Remarks

This method is used by compilers.

Applies to