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.

[SECURITY CRITICAL]

Converts an unmanaged function pointer to a delegate.

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

Syntax

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

Parameters

  • 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

Silverlight

Supported in: 5, 4, 3

Platforms

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