Table of Contents

Method PinMethodIfNeeded

Namespace
MonoMod.Core.Platforms
Assembly
MonoMod.Core.dll

PinMethodIfNeeded(MethodBase)

Pins a method so that it will not be garbage collected, if that is necessary for this runtime.
IDisposable? PinMethodIfNeeded(MethodBase method)

Parameters

method MethodBase
The method to pin.

Returns

IDisposable
An IDisposable representing the method pin, or null if none is needed.

Remarks

This must only be called if Features includes RequiresMethodPinning. Typically, callers should use PinMethodIfNeeded(MethodBase), which calls this method only when that flag is set.