UnmanagedMemoryAccessor 类

定义

提供从托管代码随机访问非托管内存块的能力。Provides random access to unmanaged blocks of memory from managed code.

public ref class UnmanagedMemoryAccessor : IDisposable
public class UnmanagedMemoryAccessor : IDisposable
type UnmanagedMemoryAccessor = class
    interface IDisposable
Public Class UnmanagedMemoryAccessor
Implements IDisposable
继承
UnmanagedMemoryAccessor
派生
实现

注解

MemoryMappedFile 对象的 CreateViewAccessor 方法返回的非托管内存块用于处理内存映射文件的视图。The CreateViewAccessor method of a MemoryMappedFile object returns the unmanaged blocks of memory for working with views of memory-mapped files.

备注

此类型可实现 IDisposable 接口,但实际上没有任何要释放的资源。This type implements the IDisposable interface, but does not actually have any resources to dispose. 这意味着无需通过直接调用 Dispose() 或使用语言构造(C# 中的 using 或 Visual Basic 中的 Using)对其进行处理。This means that disposing it by directly calling Dispose() or by using a language construct such as using (in C#) or Using (in Visual Basic) is not necessary.

构造函数

UnmanagedMemoryAccessor()

初始化 UnmanagedMemoryAccessor 类的新实例。Initializes a new instance of the UnmanagedMemoryAccessor class.

UnmanagedMemoryAccessor(SafeBuffer, Int64, Int64)

使用指定的缓冲区、偏移量和容量初始化 UnmanagedMemoryAccessor 类的新实例。Initializes a new instance of the UnmanagedMemoryAccessor class with a specified buffer, offset, and capacity.

UnmanagedMemoryAccessor(SafeBuffer, Int64, Int64, FileAccess)

使用指定的缓冲区、偏移量、容量和访问权限初始化 UnmanagedMemoryAccessor 类的新实例。Initializes a new instance of the UnmanagedMemoryAccessor class with a specified buffer, offset, capacity, and access right.

属性

CanRead

确定访问器是否可读。Determines whether the accessor is readable.

CanWrite

确定访问器是否可写。Determines whether the accessory is writable.

Capacity

获取访问器的容量。Gets the capacity of the accessor.

IsOpen

确定访问器当前是否由进程打开。Determines whether the accessor is currently open by a process.

方法

Dispose()

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

Dispose(Boolean)

释放 UnmanagedMemoryAccessor 使用的非托管资源,并选择性地释放托管资源。Releases the unmanaged resources used by the UnmanagedMemoryAccessor and optionally releases the managed resources.

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(SafeBuffer, Int64, Int64, FileAccess)

设置访问器的初始值。Sets the initial values for the accessor.

MemberwiseClone()

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

(继承自 Object)
Read<T>(Int64, T)

T 类型的结构从访问器读取到提供的引用中。Reads a structure of type T from the accessor into a provided reference.

ReadArray<T>(Int64, T[], Int32, Int32)

T 类型的结构从访问器读取到 T 类型的数组中。Reads structures of type T from the accessor into an array of type T.

ReadBoolean(Int64)

从访问器读取一个布尔值。Reads a Boolean value from the accessor.

ReadByte(Int64)

从访问器读取一个字节值。Reads a byte value from the accessor.

ReadChar(Int64)

从访问器读取一个字符。Reads a character from the accessor.

ReadDecimal(Int64)

从访问器读取一个小数值。Reads a decimal value from the accessor.

ReadDouble(Int64)

从访问器读取一个双精度浮点值。Reads a double-precision floating-point value from the accessor.

ReadInt16(Int64)

从访问器读取一个 16 位整数。Reads a 16-bit integer from the accessor.

ReadInt32(Int64)

从访问器读取一个 32 位整数。Reads a 32-bit integer from the accessor.

ReadInt64(Int64)

从访问器读取一个 64 位整数。Reads a 64-bit integer from the accessor.

ReadSByte(Int64)

从访问器读取一个 8 位带符号整数。Reads an 8-bit signed integer from the accessor.

ReadSingle(Int64)

从访问器读取一个单精度浮点值。Reads a single-precision floating-point value from the accessor.

ReadUInt16(Int64)

从访问器读取一个 16 位无符号整数。Reads an unsigned 16-bit integer from the accessor.

ReadUInt32(Int64)

从访问器读取一个 32 位无符号整数。Reads an unsigned 32-bit integer from the accessor.

ReadUInt64(Int64)

从访问器读取一个 64 位无符号整数。Reads an unsigned 64-bit integer from the accessor.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
Write(Int64, Boolean)

将一个布尔值写入访问器。Writes a Boolean value into the accessor.

Write(Int64, Byte)

将一个字节值写入访问器。Writes a byte value into the accessor.

Write(Int64, Char)

将一个字符写入访问器。Writes a character into the accessor.

Write(Int64, Decimal)

将一个小数值写入访问器。Writes a decimal value into the accessor.

Write(Int64, Double)

将一个 Double 值写入访问器。Writes a Double value into the accessor.

Write(Int64, Int16)

将一个 16 位整数写入访问器。Writes a 16-bit integer into the accessor.

Write(Int64, Int32)

将一个 32 位整数写入访问器。Writes a 32-bit integer into the accessor.

Write(Int64, Int64)

将一个 64 位整数写入访问器。Writes a 64-bit integer into the accessor.

Write(Int64, SByte)

将一个 8 位整数写入访问器。Writes an 8-bit integer into the accessor.

Write(Int64, Single)

将一个 Single 写入访问器。Writes a Single into the accessor.

Write(Int64, UInt16)

将一个 16 位无符号整数写入访问器。Writes an unsigned 16-bit integer into the accessor.

Write(Int64, UInt32)

将一个 32 位无符号整数写入访问器。Writes an unsigned 32-bit integer into the accessor.

Write(Int64, UInt64)

将一个 64 位无符号整数写入访问器。Writes an unsigned 64-bit integer into the accessor.

Write<T>(Int64, T)

将一个结构写入访问器。Writes a structure into the accessor.

WriteArray<T>(Int64, T[], Int32, Int32)

将结构从 T 类型的数组写入访问器。Writes structures from an array of type T into the accessor.

适用于