System.Threading.Overlapped.Pack Method

Packs the current instance into a System.Threading.NativeOverlapped structure, specifying a delegate that is invoked when the asynchronous I/O operation is complete and a managed object that serves as a buffer.

Syntax

[System.CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(false)]
public NativeOverlapped* Pack (IOCompletionCallback iocb, object userData)

Parameters

iocb
An System.Threading.IOCompletionCallback delegate that represents the callback method invoked when the asynchronous I/O operation completes.
userData
An object or array of objects representing the input or output buffer for the operation. Each object represents a buffer, for example an array of bytes.

Returns

An unmanaged pointer to a System.Threading.NativeOverlapped structure.

Remarks

The unmanaged pointer returned by this method can be passed to the operating system in overlapped I/O operations. The System.Threading.NativeOverlapped structure is fixed in physical memory until Overlapped.Unpack(NativeOverlapped*) is called.

The buffer or buffers specified in userData must be the same as those passed to the unmanaged operating system function that performs the asynchronous I/O.

Note:

The runtime pins the buffer or buffers specified in userData for the duration of the I/O operation. If the application domain is unloaded, the runtime keeps the memory pinned until the I/O operation completes.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0