Creates a memory-mapped file that has the specified access mode, name, and capacity from a file on disk.
- path
- The path to the file to map.
- mode
- Access mode; can be any of the System.IO.FileMode enumeration values except System.IO.FileMode.Append.
- mapName
- A name to assign to the memory-mapped file.
- capacity
- The maximum size, in bytes, to allocate to the memory-mapped file. Specify 0 to set the capacity to the size of the file on disk.
A memory-mapped file that has the specified characteristics.
The mode parameter pertains to the source file on disk.
If capacity is larger than the size of the file on disk, the file on disk is increased to match the specified capacity even if no data is written to the memory-mapped file. To prevent this from occurring, specify 0 (zero) for the default capacity, which will internally set capacity to the size of the file on disk.