Edit

Share via


Memory2D<T>.Pin Method

Definition

Creates a handle for the memory. The GC will not move the memory until the returned MemoryHandle is disposed, enabling taking and using the memory's address.

public System.Buffers.MemoryHandle Pin ();
member this.Pin : unit -> System.Buffers.MemoryHandle
Public Function Pin () As MemoryHandle

Returns

A MemoryHandle instance wrapping the pinned handle.

Exceptions

An instance with nonprimitive (non-blittable) members cannot be pinned.

Applies to