This documentation is archived and is not being maintained.

RuntimeHelpers.PrepareMethod Method (RuntimeMethodHandle)

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

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

[SecurityPermissionAttribute(SecurityAction.LinkDemand, UnmanagedCode = true)]
public static void PrepareMethod(
	RuntimeMethodHandle method


Type: System.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.

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

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

.NET Framework

Supported in: 3.5, 3.0, 2.0