共用方式為


Overlapped.Pack 方法

定義

將目前的執行個體封裝到 NativeOverlapped 結構。

多載

Pack(IOCompletionCallback)
已過時。
已過時。
已過時。
已過時。

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所要叫用的委派。

Pack(IOCompletionCallback, Object)

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所叫用的委派,以及當做緩衝區的 Managed 物件。

Pack(IOCompletionCallback)

警告

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

警告

Use Pack(iocb, userData) instead

重要

此 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("Use Pack(iocb, userData) 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.  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>
[<System.CLSCompliant(false)>]
[<System.Obsolete("Use Pack(iocb, userData) instead")>]
member this.Pack : System.Threading.IOCompletionCallback -> nativeptr<System.Threading.NativeOverlapped>

參數

iocb
IOCompletionCallback

IOCompletionCallback 委派,表示非同步的 I/O 作業完成時所要叫用的回呼方法。

傳回

NativeOverlapped*

NativeOverlapped 結構的 Unmanaged 指標。

屬性

例外狀況

目前的 Overlapped 已被封裝。

備註

這個方法所傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 會在實體記憶體中固定,直到 Unpack 呼叫 為止。

重要

呼叫端負責釘選緩衝區。 不過,如果卸載應用程式域,則會終結固定緩衝區的控制碼,並釋放緩衝區,讓 I/O 作業寫入釋放的位址。 因此,最好使用 Pack(IOCompletionCallback, Object) 方法多載,其中執行時間會釘選緩衝區。

適用於

Pack(IOCompletionCallback, Object)

重要

此 API 不符合 CLS 規範。

將目前的執行個體封裝到 NativeOverlapped 結構,指定非同步的 I/O 作業完成時所叫用的委派,以及當做緩衝區的 Managed 物件。

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*

NativeOverlapped 結構的 Unmanaged 指標。

屬性

例外狀況

目前的 Overlapped 已被封裝。

備註

這個方法所傳回的 Unmanaged 指標可以傳遞至重迭 I/O 作業中的作業系統。 結構 NativeOverlapped 會在實體記憶體中固定,直到 Unpack 呼叫 為止。

中指定的 userData 緩衝區或緩衝區必須與傳遞至執行非同步 I/O 之 Unmanaged 作業系統函式的緩衝區相同。

注意

執行時間會在 I/O 作業期間釘選 中指定的 userData 緩衝區或緩衝區。 如果卸載應用程式域,執行時間會保留固定記憶體,直到 I/O 作業完成為止。

適用於