Marshal.GetFunctionPointerForDelegate 方法

定义

重载

GetFunctionPointerForDelegate(Delegate)
已过时.

将委托转换为可从非托管代码调用的函数指针。

GetFunctionPointerForDelegate<TDelegate>(TDelegate)

将指定类型的委托转换为可从非托管代码调用的函数指针。

GetFunctionPointerForDelegate(Delegate)

Source:
Marshal.cs
Source:
Marshal.cs
Source:
Marshal.cs

注意

GetFunctionPointerForDelegate(Delegate) may be unavailable in future releases. Instead, use GetFunctionPointerForDelegate<T>(T). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296522

将委托转换为可从非托管代码调用的函数指针。

public:
 static IntPtr GetFunctionPointerForDelegate(Delegate ^ d);
[System.Obsolete("GetFunctionPointerForDelegate(Delegate) may be unavailable in future releases. Instead, use GetFunctionPointerForDelegate<T>(T). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296522")]
[System.Security.SecurityCritical]
public static IntPtr GetFunctionPointerForDelegate (Delegate d);
public static IntPtr GetFunctionPointerForDelegate (Delegate d);
[System.Security.SecurityCritical]
public static IntPtr GetFunctionPointerForDelegate (Delegate d);
[<System.Obsolete("GetFunctionPointerForDelegate(Delegate) may be unavailable in future releases. Instead, use GetFunctionPointerForDelegate<T>(T). For more info, go to http://go.microsoft.com/fwlink/?LinkID=296522")>]
[<System.Security.SecurityCritical>]
static member GetFunctionPointerForDelegate : Delegate -> nativeint
static member GetFunctionPointerForDelegate : Delegate -> nativeint
[<System.Security.SecurityCritical>]
static member GetFunctionPointerForDelegate : Delegate -> nativeint
Public Shared Function GetFunctionPointerForDelegate (d As Delegate) As IntPtr

参数

d
Delegate

要传递给非托管代码的委托。

返回

IntPtr

nativeint

一个可传递给非托管代码的值,非托管代码使用该值来调用基础托管委托。

属性

例外

d 参数是泛型类型定义。

d 参数为 null

注解

d委托将转换为可以使用默认平台调用约定传递给非托管代码的函数指针。 可以通过将 应用于 UnmanagedFunctionPointerAttribute 委托来设置调用约定。

必须手动防止垃圾回收器从托管代码中收集委托。 垃圾回收器不跟踪对非托管代码的引用。

适用于

GetFunctionPointerForDelegate<TDelegate>(TDelegate)

Source:
Marshal.cs
Source:
Marshal.cs
Source:
Marshal.cs

将指定类型的委托转换为可从非托管代码调用的函数指针。

public:
generic <typename TDelegate>
 static IntPtr GetFunctionPointerForDelegate(TDelegate d);
[System.Security.SecurityCritical]
public static IntPtr GetFunctionPointerForDelegate<TDelegate> (TDelegate d);
public static IntPtr GetFunctionPointerForDelegate<TDelegate> (TDelegate d);
[<System.Security.SecurityCritical>]
static member GetFunctionPointerForDelegate : 'Delegate -> nativeint
static member GetFunctionPointerForDelegate : 'Delegate -> nativeint
Public Shared Function GetFunctionPointerForDelegate(Of TDelegate) (d As TDelegate) As IntPtr

类型参数

TDelegate

要转换的委托的类型。

参数

d
TDelegate

要传递给非托管代码的委托。

返回

IntPtr

nativeint

一个可传递给非托管代码的值,非托管代码使用该值来调用基础托管委托。

属性

例外

d 参数是泛型类型定义。

d 参数为 null

注解

d委托转换为可以使用默认平台调用约定传递给非托管代码的函数指针。 可以通过将 应用于 UnmanagedFunctionPointerAttribute 委托来设置调用约定。

必须手动防止垃圾回收器从托管代码中收集委托。 垃圾回收器不跟踪对非托管代码的引用。

适用于