Skip to content

Take a look at MemoryMappedFile #138

@SoloByte

Description

@SoloByte

For storing resources on disk but having normal access to them

using System;
using System.IO.MemoryMappedFiles;

class Program
{
    static void Main()
    {
        // Create a memory-mapped file of 4 bytes
        using var mmf = MemoryMappedFile.CreateNew("testmap", 4);

        // Write an integer to the memory-mapped file
        using (var accessor = mmf.CreateViewAccessor())
        {
            accessor.Write(0, 12345);
        }

        // Read the integer back
        using (var accessor = mmf.CreateViewAccessor())
        {
            int value = accessor.ReadInt32(0);
            Console.WriteLine(value); // Output: 12345
        }
    }
}

Metadata

Metadata

Assignees

Labels

questionFurther information is requested

Type

Projects

Status

Planned

Relationships

None yet

Development

No branches or pull requests

Issue actions