SafeMemoryMappedViewHandle 类

定义

提供一个表示用于随机访问的非托管内存块的视图的安全句柄。Provides a safe handle that represents a view of a block of unmanaged memory for random access.

public ref class SafeMemoryMappedViewHandle sealed : System::Runtime::InteropServices::SafeBuffer
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public sealed class SafeMemoryMappedViewHandle : System.Runtime.InteropServices.SafeBuffer
type SafeMemoryMappedViewHandle = class
    inherit SafeBuffer
Public NotInheritable Class SafeMemoryMappedViewHandle
Inherits SafeBuffer
继承
属性

注解

MemoryMappedViewAccessor.SafeMemoryMappedViewHandle使用属性可获取安全句柄。Use the MemoryMappedViewAccessor.SafeMemoryMappedViewHandle property to obtain the safe handle.

重要

此类型实现 IDisposable 接口。This type implements the IDisposable interface. 在使用完类型后,您应直接或间接释放类型。When you have finished using the type, you should dispose of it either directly or indirectly. 若要直接释放类型,请在 try/catch 块中调用其 Dispose 方法。To dispose of the type directly, call its Dispose method in a try/catch block. 若要间接释放类型,请使用 using(在 C# 中)或 Using(在 Visual Basic 中)等语言构造。To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). 有关详细信息,请参阅 IDisposable 接口主题中的“使用实现 IDisposable 的对象”一节。For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

字段

handle

指定要包装的句柄。Specifies the handle to be wrapped.

(继承自 SafeHandle)

属性

ByteLength

获取缓冲区的大小(以字节为单位)。Gets the size of the buffer, in bytes.

(继承自 SafeBuffer)
IsClosed

获取一个值,该值指示句柄是否已关闭。Gets a value indicating whether the handle is closed.

(继承自 SafeHandle)
IsInvalid (继承自 SafeBuffer)

方法

AcquirePointer(Byte*)

从内存块的 SafeBuffer 对象中获取一个指针。Obtains a pointer from a SafeBuffer object for a block of memory.

(继承自 SafeBuffer)
Close()

标记句柄,以便释放资源。Marks the handle for releasing and freeing resources.

(继承自 SafeHandle)
DangerousAddRef(Boolean)

手动递增 SafeHandle 实例中的引用计数器。Manually increments the reference counter on SafeHandle instances.

(继承自 SafeHandle)
DangerousGetHandle()

返回 handle 字段的值。Returns the value of the handle field.

(继承自 SafeHandle)
DangerousRelease()

手动递减 SafeHandle 实例中的引用计数器。Manually decrements the reference counter on a SafeHandle instance.

(继承自 SafeHandle)
Dispose()

释放 SafeHandle 类使用的所有资源。Releases all resources used by the SafeHandle class.

(继承自 SafeHandle)
Dispose(Boolean)

释放 SafeHandle 类所使用的非托管资源,并指定是否执行常规释放 (Dispose) 操作。Releases the unmanaged resources used by the SafeHandle class specifying whether to perform a normal dispose operation.

(继承自 SafeHandle)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
Initialize(UInt32, UInt32)

通过使用指定的元素数和元素大小,指定内存缓冲区的分配大小。Specifies the allocation size of the memory buffer by using the specified number of elements and element size. 在使用 SafeBuffer 实例之前,必须调用此方法。You must call this method before you use the SafeBuffer instance.

(继承自 SafeBuffer)
Initialize(UInt64)

定义内存区域的分配大小(以字节为单位)。Defines the allocation size of the memory region in bytes. 在使用 SafeBuffer 实例之前,必须调用此方法。You must call this method before you use the SafeBuffer instance.

(继承自 SafeBuffer)
Initialize<T>(UInt32)

通过指定值类型的数目,定义内存区域的分配大小。Defines the allocation size of the memory region by specifying the number of value types. 在使用 SafeBuffer 实例之前,必须调用此方法。You must call this method before you use the SafeBuffer instance.

(继承自 SafeBuffer)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Read<T>(UInt64)

按指定的偏移量从内存中读取值类型。Reads a value type from memory at the specified offset.

(继承自 SafeBuffer)
ReadArray<T>(UInt64, T[], Int32, Int32)

从自偏移量开始的内存中读取指定数量的值类型,并将它们写入从索引开始的数组中。Reads the specified number of value types from memory starting at the offset, and writes them into an array starting at the index.

(继承自 SafeBuffer)
ReleaseHandle()

如果在派生类中重写,执行释放句柄所需的代码。When overridden in a derived class, executes the code required to free the handle.

(继承自 SafeHandle)
ReleasePointer()

释放由 AcquirePointer(Byte*) 方法获取的指针。Releases a pointer that was obtained by the AcquirePointer(Byte*) method.

(继承自 SafeBuffer)
SetHandle(IntPtr)

将句柄设置为预先存在的指定句柄。Sets the handle to the specified pre-existing handle.

(继承自 SafeHandle)
SetHandleAsInvalid()

将句柄标记为不再使用。Marks a handle as no longer used.

(继承自 SafeHandle)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)
Write<T>(UInt64, T)

将值类型写入内存中的给定位置。Writes a value type to memory at the given location.

(继承自 SafeBuffer)
WriteArray<T>(UInt64, T[], Int32, Int32)

通过读取从输入数组中指定位置开始的字节,将指定数目的值类型写入内存位置。Writes the specified number of value types to a memory location by reading bytes starting from the specified location in the input array.

(继承自 SafeBuffer)

适用于