Edit

Share via


PreAllocatedOverlapped(IOCompletionCallback, Object, Object) Constructor

Definition

Important

This API is not CLS-compliant.

Initializes a new instance of the PreAllocatedOverlapped class and specifies a delegate to invoke when each asynchronous I/O operation is complete, a user-provided object that provides context, and managed objects that serve as buffers.

public:
 PreAllocatedOverlapped(System::Threading::IOCompletionCallback ^ callback, System::Object ^ state, System::Object ^ pinData);
[System.CLSCompliant(false)]
public PreAllocatedOverlapped (System.Threading.IOCompletionCallback callback, object state, object pinData);
[System.CLSCompliant(false)]
public PreAllocatedOverlapped (System.Threading.IOCompletionCallback callback, object? state, object? pinData);
[<System.CLSCompliant(false)>]
new System.Threading.PreAllocatedOverlapped : System.Threading.IOCompletionCallback * obj * obj -> System.Threading.PreAllocatedOverlapped
Public Sub New (callback As IOCompletionCallback, state As Object, pinData As Object)

Parameters

callback
IOCompletionCallback

A delegate that represents the callback method to invoke when each asynchronous I/O operation completes.

state
Object

A user-supplied object that distinguishes the NativeOverlapped instance produced from this object from other NativeOverlapped instances. Its value can be null.

pinData
Object

An object or array of objects that represent the input or output buffer for the operations. Each object represents a buffer, such as an array of bytes. Its value can be null.

Attributes

Exceptions

callback is null.

This method was called after the ThreadPoolBoundHandle was disposed.

Remarks

The new PreAllocatedOverlapped instance can be passed to the AllocateNativeOverlapped method to produce a NativeOverlapped instance that can be passed to the operating system in overlapped I/O operations. A single PreAllocatedOverlapped instance can only be used for a single native I/O operation at a time. However, the state stored in the PreAllocatedOverlapped instance can be reused for subsequent native operations.

Note

The buffers specified in pinData are pinned until the Dispose method is called.

Applies to