MemoryMappedFileStatic: CreateNew

CreateNew

Creates a memory-mapped file that has the specified capacity and access type in system memory.



 Public Function CreateNew(
	  ByRef MapName As String,
	  ByVal Capacity As Currency,
	  Optional ByVal Access As MemoryMappedFileAccess = MemoryMappedFileAccess. ReadWrite ) As MemoryMappedFile

Parameters

MapName
[ByRef] String. A name to assign to the memory-mapped file.
Capacity
[ByVal] Currency. The maximum size, in bytes, to allocate to the memory-mapped file.
Access
[ByVal] Optional. MemoryMappedFileAccess. One of the enumeration values that specifies the type of access allowed to the memory-mapped file. The default is ReadWrite.  

Default: MemoryMappedFileAccess . ReadWrite

Return Values

MemoryMappedFile -  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.

Exceptions

ExceptionCondition
ArgumentException MapName is an empty string.
-or-
Access is set to write-only with the WriteOnly enumeration value.
Capacity is less than or equal to zero.
-or-
Access is not a valid MemoryMappedFileAccess enumeration value.

See Also

Project CorLib Overview

Class MemoryMappedFileStatic Overview