Export (0) Print
Expand All

RuntimeHelpers.PrepareMethod Method (RuntimeMethodHandle)

Note: This method is new in the .NET Framework version 2.0.

Prepares a method for inclusion in a Constrained Execution Region (CER).

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

public static void PrepareMethod (
	RuntimeMethodHandle method
public static void PrepareMethod (
	RuntimeMethodHandle method
public static function PrepareMethod (
	method : RuntimeMethodHandle



A RuntimeMethodHandle to the method to prepare.

You can use the PrepareMethod(RuntimeMethodHandle) method to handle virtual calls 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 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.

The classes in System.Runtime.CompilerServices are for compiler writers' use only.

The following code example demonstrates the use of PrepareMethod(RuntimeMethodHandle) with a virtual method:

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2014 Microsoft