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

 

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

Namespace:   System.Runtime.CompilerServices
Assembly:  mscorlib (in mscorlib.dll)

[SecurityCriticalAttribute]
public static void ExecuteCodeWithGuaranteedCleanup(
	RuntimeHelpers.TryCode code,
	RuntimeHelpers.CleanupCode backoutCode,
	object userData
)

Parameters

code
Type: System.Runtime.CompilerServices.RuntimeHelpers.TryCode

A delegate to the code to try.

backoutCode
Type: System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode

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

userData
Type: System.Object

The data to pass to code and backoutCode.

This method is used by compilers.

SecurityCriticalAttribute

requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

.NET Framework
Available since 2.0
Return to top
Show: