Memory-Mapped Files in a Nutshell

Introduced in .NET 4.0, memory-mapped files is yet another exposure of Win32 power to managed code developers. With memory-mapped files, you can achieve a number of things. One is to set up interprocess communication once more, this time using shared memory that’s identified with a “map name.” Multiple processes can read from and write to the shared memory. For this to work properly, some kind of synchronization will be needed, which goes beyond what we can cover in this book.

Another capability is closer to everyday development, though: the ability to work with extremely large files by mapping them into the memory address space and accessing them as if it were in-memory data. This includes the ability to do ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.