System.Threading.Overlapped.Pack Method

Packs the current instance into a System.Threading.NativeOverlapped structure, specifying the delegate to be invoked when the asynchronous I/O operation is complete.

Syntax

[System.CLSCompliant(false)]
[System.Obsolete("Use Pack(iocb, userData) instead")]
public NativeOverlapped* Pack (IOCompletionCallback iocb)

Parameters

iocb
An System.Threading.IOCompletionCallback delegate that represents the callback method invoked when the asynchronous I/O operation completes.

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.

Note:

The caller is responsible for pinning the buffer. If the application domain is unloaded, however, the handle to the pinned buffer is destroyed and the buffer is released, leaving the I/O operation to write to the freed address. For this reason, it is better to use the Overlapped.Pack(IOCompletionCallback, object) method overload, in which the runtime pins the buffer.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0