Overlapped.Pack 方法

定义

将当前实例打包为一个 NativeOverlapped 结构。

重载

Pack(IOCompletionCallback)
已过时.
已过时.
已过时.

将当前实例打包为一个 NativeOverlapped 结构,并指定当异步 I/O 操作完成时调用的委托。

Pack(IOCompletionCallback, Object)

将当前实例打包为一个 NativeOverlapped 结构,并指定当异步 I/O 操作完成时调用的委托,以及作为缓冲区的托管对象。

Pack(IOCompletionCallback)

Source:
Overlapped.cs
Source:
Overlapped.cs
Source:
Overlapped.cs

注意

This method is not safe. Use Pack (iocb, userData) instead. https://go.microsoft.com/fwlink/?linkid=14202

注意

This overload is not safe and has been deprecated. Use Pack(IOCompletionCallback?, object?) instead.

注意

This method is not safe. Use Pack (iocb, userData) instead. http://go.microsoft.com/fwlink/?linkid=14202

重要

此 API 不符合 CLS。

将当前实例打包为一个 NativeOverlapped 结构,并指定当异步 I/O 操作完成时调用的委托。

public:
 System::Threading::NativeOverlapped* Pack(System::Threading::IOCompletionCallback ^ iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback? iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This overload is not safe and has been deprecated. Use Pack(IOCompletionCallback?, object?) instead.")]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback? iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")]
[System.Security.SecurityCritical]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb);
[System.CLSCompliant(false)]
[System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb);
[<System.CLSCompliant(false)>]
[<System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  https://go.microsoft.com/fwlink/?linkid=14202")>]
member this.Pack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Obsolete("This overload is not safe and has been deprecated. Use Pack(IOCompletionCallback?, object?) instead.")>]
member this.Pack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
member this.Pack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
member this.Pack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Obsolete("This method is not safe.  Use Pack (iocb, userData) instead.  http://go.microsoft.com/fwlink/?linkid=14202")>]
[<System.Security.SecurityCritical>]
member this.Pack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>

参数

iocb
IOCompletionCallback

一个 IOCompletionCallback 委托,表示在异步 I/O 操作完成时调用的回调方法。

返回

一个指向 NativeOverlapped 结构的非托管指针。

属性

例外

已对当前的 Overlapped 打包。

注解

此方法返回的非托管指针可以通过重叠的 I/O 操作传递给操作系统。 在调用 之前Unpack,结构NativeOverlapped在物理内存中固定。

重要

调用方负责固定缓冲区。 但是,如果卸载应用程序域,则会销毁固定缓冲区的句柄,释放缓冲区,使 I/O 操作写入释放地址。 因此,最好使用 Pack(IOCompletionCallback, Object) 方法重载,其中运行时固定缓冲区。

适用于

Pack(IOCompletionCallback, Object)

Source:
Overlapped.cs
Source:
Overlapped.cs
Source:
Overlapped.cs

重要

此 API 不符合 CLS。

将当前实例打包为一个 NativeOverlapped 结构,并指定当异步 I/O 操作完成时调用的委托,以及作为缓冲区的托管对象。

public:
 System::Threading::NativeOverlapped* Pack(System::Threading::IOCompletionCallback ^ iocb, System::Object ^ userData);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback? iocb, object? userData);
[System.CLSCompliant(false)]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb, object userData);
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb, object userData);
[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
[System.Security.SecurityCritical]
public System.Threading.NativeOverlapped* Pack (System.Threading.IOCompletionCallback iocb, object userData);
[<System.CLSCompliant(false)>]
member this.Pack : System.Threading.IOCompletionCallback * obj -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.Pack : System.Threading.IOCompletionCallback * obj -> nativeptr<System.Threading.NativeOverlapped>
[<System.CLSCompliant(false)>]
[<System.Runtime.InteropServices.ComVisible(false)>]
[<System.Security.SecurityCritical>]
member this.Pack : System.Threading.IOCompletionCallback * obj -> nativeptr<System.Threading.NativeOverlapped>

参数

iocb
IOCompletionCallback

一个 IOCompletionCallback 委托,表示在异步 I/O 操作完成时调用的回调方法。

userData
Object

对象或对象的数组,表示用于操作的输入或输出缓冲区。 每个对象都表示一个缓冲区,例如字节数组。

返回

一个指向 NativeOverlapped 结构的非托管指针。

属性

例外

已对当前的 Overlapped 打包。

注解

此方法返回的非托管指针可以通过重叠的 I/O 操作传递给操作系统。 在调用 之前Unpack,结构NativeOverlapped在物理内存中固定。

中指定的 userData 缓冲区必须与传递给执行异步 I/O 的非托管操作系统函数的缓冲区相同。

注意

运行时在 I/O 操作期间固定 在 中指定的 userData 缓冲区。 如果卸载应用程序域,运行时会一直固定内存,直到 I/O 操作完成。

适用于