ReadOnlyMemory<T>.Pin 方法

定义

为内存创建句柄。Creates a handle for the memory.

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

返回

内存的句柄。A handle for the memory.

异常

具有非基元(非直接复制到本机结构中的)成员的实例不能被固定。An instance with nonprimitive (non-blittable) members cannot be pinned.

注解

重要

垃圾回收器不会移动内存, 直到释放返回的, 从而实现并使用内存的地址。The garbage collector will not move the memory until the returned is disposed, enabling taking and using the memory's address.

适用于