Marshal.GetDelegateForFunctionPointer Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This type can be used only by trusted applications. If you try to use its members in a partial-trust application, your code will throw a MethodAccessException exception. This type is security-critical, which restricts its use.


Converts an unmanaged function pointer to a delegate.

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


<SecurityCriticalAttribute> _
Public Shared Function GetDelegateForFunctionPointer ( _
    ptr As IntPtr, _
    t As Type _
) As Delegate
public static Delegate GetDelegateForFunctionPointer(
    IntPtr ptr,
    Type t


  • t
    Type: System.Type
    The type of the delegate to be returned.

Return Value

Type: System.Delegate
A delegate instance that can be cast to the appropriate delegate type.

Version Information


Supported in: 5, 4, 3


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.