Show / Hide Table of Contents

Class MemoryMappedFileExtensions

Represents various extensions for MemoryMappedFile class.

Inheritance
object
MemoryMappedFileExtensions
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: DotNext.IO.MemoryMappedFiles
Assembly: DotNext.Unsafe.dll
Syntax
public static class MemoryMappedFileExtensions

Methods

View Source

CreateDirectAccessor(MemoryMappedFile, long, long, MemoryMappedFileAccess)

Creates direct accessor to the virtual memory associated with the memory-mapped file.

Declaration
public static MemoryMappedDirectAccessor CreateDirectAccessor(this MemoryMappedFile file, long offset = 0, long size = 0, MemoryMappedFileAccess access = MemoryMappedFileAccess.ReadWrite)
Parameters
Type Name Description
MemoryMappedFile file

The memory-mapped file.

long offset

The byte at which to start the view.

long size

The size of the view. Specify 0 (zero) to create a view that starts at offset and ends approximately at the end of the memory-mapped file.

MemoryMappedFileAccess access

the type of access allowed to the memory-mapped file.

Returns
Type Description
MemoryMappedDirectAccessor

The direct accessor.

Exceptions
Type Condition
ArgumentOutOfRangeException

offset or size is less than zero.

View Source

CreateMemoryAccessor(MemoryMappedFile, long, int, MemoryMappedFileAccess)

Creates memory accessor to the virtual memory associated with the memory-mapped file.

Declaration
[CLSCompliant(false)]
public static IMappedMemory CreateMemoryAccessor(this MemoryMappedFile file, long offset = 0, int size = 0, MemoryMappedFileAccess access = MemoryMappedFileAccess.ReadWrite)
Parameters
Type Name Description
MemoryMappedFile file

The memory-mapped file.

long offset

The byte at which to start the view.

int size

The size of the view. Specify 0 (zero) to create a view that starts at offset and ends approximately at the end of the memory-mapped file.

MemoryMappedFileAccess access

the type of access allowed to the memory-mapped file.

Returns
Type Description
IMappedMemory

The direct accessor.

Remarks

This method is suitable if you need to represent memory-mapped file segment as Memory<T>.

Exceptions
Type Condition
ArgumentOutOfRangeException

offset or size is less than zero.

  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾