RuntimeHelpers.PrepareMethod Method (RuntimeMethodHandle)


Prepares a method for inclusion in a constrained execution region (CER).

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

static member PrepareMethod : 
        method:RuntimeMethodHandle -> unit


Type: System.RuntimeMethodHandle

A handle to the method to prepare.

Compilers use the PrepareMethod(RuntimeMethodHandle) method to handle virtual calls that are made inside a constrained execution region (CER). At JIT compilation time, the common language runtime does not usually have enough information about the target of a virtual call. Therefore, the runtime does not initially prepare that segment of the call graph. If the code that is using the CER has enough knowledge to determine the target at any point in time before the CER is actually entered, it can call PrepareMethod(RuntimeMethodHandle) to perform the same runtime preparation normally done for a CER rooted at the method specified as an argument.


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