Class MemoryMappedFileExtensions
Represents various extensions for MemoryMappedFile class.
Inherited Members
Namespace: DotNext.IO.MemoryMappedFiles
Assembly: DotNext.Unsafe.dll
Syntax
public static class MemoryMappedFileExtensions
Methods
| Edit this page View SourceCreateDirectAccessor(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 |
|
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 |
|