System.IO.MemoryMappedFiles.MemoryMappedFile Class

Represents a memory-mapped file.

See Also: MemoryMappedFile Members

Syntax

public class MemoryMappedFile : IDisposable

Remarks

A memory-mapped file maps the contents of a file to an application’s logical address space. Memory-mapped files enable programmers to work with extremely large files because memory can be managed concurrently, and they allow complete, random access to a file without the need for seeking. Memory-mapped files can also be shared across multiple processes.

The erload:System.IO.MemoryMappedFiles.MemoryMappedFile.CreateFromFile methods create a memory-mapped file from a specified path or a System.IO.FileStream of an existing file on disk. Changes are automatically propagated to disk when the file is unmapped.

The erload:System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew methods create a memory-mapped file that is not mapped to an existing file on disk; and are suitable for creating shared memory for interprocess communication (IPC).

A memory-mapped file is associated with a name.

You can create multiple views of the memory-mapped file, including views of parts of the file. You can map the same part of a file to more than one address to create concurrent memory. For two views to remain concurrent, they have to be created from the same memory-mapped file. Creating two file mappings of the same file with two views does not provide concurrency.

Requirements

Namespace: System.IO.MemoryMappedFiles
Assembly: System.Core (in System.Core.dll)
Assembly Versions: 4.0.0.0