The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

RuntimeHelpers.PrepareMethod Method (RuntimeMethodHandle)

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
Not applicable.



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 Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft