System.IO.MemoryMappedFiles.MemoryMappedFile.CreateNew Method

Creates a memory-mapped file that has the specified capacity, access type, memory allocation, security permissions, and inheritability in system memory.

Syntax

[System.MonoLimitation("CreateNew requires that mapName be a file name on Unix; options and memoryMappedFileSecurity are ignored")]
public static MemoryMappedFile CreateNew (string mapName, long capacity, MemoryMappedFileAccess access, MemoryMappedFileOptions options, MemoryMappedFileSecurity memoryMappedFileSecurity, System.IO.HandleInheritability inheritability)

Parameters

mapName
A name to assign to the memory-mapped file.
capacity
The maximum size, in bytes, to allocate to the memory-mapped file.
access
One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is MemoryMappedFileAccess.ReadWrite.
options
A bitwise combination of enumeration values that specifies memory allocation options for the memory-mapped file.
memoryMappedFileSecurity
The permissions that can be granted for file access and operations on memory-mapped files.
inheritability
One of the enumeration values that specifies whether a handle to the memory-mapped file can be inherited by a child process. The default is System.IO.HandleInheritability.None.

Returns

A memory-mapped file that has the specified characteristics.

Remarks

Use this method to create a memory-mapped file that is not persisted (that is, not associated with a file on disk), which you can use to share data between processes.

Requirements

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