Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​IO.​UnmanagedMemoryAccessor
Assembly: System.Runtime.InteropServices
Inheritance: object → UnmanagedMemoryAccessor
Provides random access to unmanaged blocks of memory from managed code.
Properties
public
bool
CanRead
Determines whether the accessor is readable.
public
bool
CanWrite
Determines whether the accessory is writable.
public
long
Capacity
Gets the capacity of the accessor.
protected
bool
IsOpen
Determines whether the accessor is currently open by a process.
Methods
public
void
Dispose​()
Releases all resources used by the <see cref="T:System.IO.UnmanagedMemoryAccessor" /> .
protected
void
Dispose​(bool disposing)
disposing
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.
Releases the unmanaged resources used by the <see cref="T:System.IO.UnmanagedMemoryAccessor" /> and optionally releases the managed resources.
protected
void
Initialize​(Runtime.InteropServices.SafeBuffer buffer,
long offset,
long capacity,
FileAccess access)
buffer
The buffer to contain the accessor.
offset
The byte at which to start the accessor.
capacity
The size, in bytes, of memory to allocate.
access
The type of access allowed to the memory. The default is <see cref="F:System.IO.MemoryMappedFiles.MemoryMappedFileAccess.ReadWrite" /> .
Sets the initial values for the accessor.
public
int
ReadArray​(long position,
T[] array,
int offset,
int count)
public
bool
ReadBoolean​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns <see langword="true" /> or <see langword="false" /> .
Reads a Boolean value from the accessor.
public
byte
ReadByte​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a byte value from the accessor.
public
char
ReadChar​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a character from the accessor.
public
decimal
ReadDecimal​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a decimal value from the accessor.
public
double
ReadDouble​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a double-precision floating-point value from the accessor.
public
short
ReadInt16​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a 16-bit integer from the accessor.
public
int
ReadInt32​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a 32-bit integer from the accessor.
public
long
ReadInt64​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a 64-bit integer from the accessor.
public
sbyte
ReadSByte​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads an 8-bit signed integer from the accessor.
public
Single
ReadSingle​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads a single-precision floating-point value from the accessor.
public
ushort
ReadUInt16​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads an unsigned 16-bit integer from the accessor.
public
uint
ReadUInt32​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads an unsigned 32-bit integer from the accessor.
public
ulong
ReadUInt64​(long position)
position
The number of bytes into the accessor at which to begin reading.
Returns The value that was read.
Reads an unsigned 64-bit integer from the accessor.
public
void
Write​(long position,
bool value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a Boolean value into the accessor.
public
void
Write​(long position,
byte value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a byte value into the accessor.
public
void
Write​(long position,
char value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a character into the accessor.
public
void
Write​(long position,
decimal value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a decimal value into the accessor.
public
void
Write​(long position,
double value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a <see cref="T:System.Double" /> value into the accessor.
public
void
Write​(long position,
short value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a 16-bit integer into the accessor.
public
void
Write​(long position,
int value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a 32-bit integer into the accessor.
public
void
Write​(long position,
long value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a 64-bit integer into the accessor.
public
void
Write​(long position,
sbyte value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes an 8-bit integer into the accessor.
public
void
Write​(long position,
Single value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes a <see cref="T:System.Single" /> into the accessor.
public
void
Write​(long position,
ushort value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes an unsigned 16-bit integer into the accessor.
public
void
Write​(long position,
uint value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes an unsigned 32-bit integer into the accessor.
public
void
Write​(long position,
ulong value)
position
The number of bytes into the accessor at which to begin writing.
value
The value to write.
Writes an unsigned 64-bit integer into the accessor.
public
void
WriteArray​(long position,
T[] array,
int offset,
int count)
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object