Export (0) Print
Expand All

Overlapped.Pack Method (IOCompletionCallback, Object)

Packs the current instance into a 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.

This API is not CLS-compliant. 

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

[CLSCompliantAttribute(false)]
[ComVisibleAttribute(false)]
public NativeOverlapped* Pack(
	IOCompletionCallback iocb,
	Object userData
)

Parameters

iocb
Type: System.Threading.IOCompletionCallback

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

userData
Type: System.Object

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.

Return Value

Type: System.Threading.NativeOverlapped*
An unmanaged pointer to a NativeOverlapped structure.

ExceptionCondition
InvalidOperationException

The current Overlapped has already been packed.

The unmanaged pointer returned by this method can be passed to the operating system in overlapped I/O operations. The NativeOverlapped structure is fixed in physical memory until Unpack 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.

NoteNote

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • SecurityCriticalAttribute 

    Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft