简体   繁体   中英

how to work with variables in files instead of memory in c#(like pagefile)

I have written a program that I have to save large data in the variables. how can I use files instead of memory? like virtual memory (page file)

You can leverage Memory Mapped Files for this. In .NET Framework this nice feature is available since version 4.0 .

See Non-persisted memory-mapped files

Non-persisted files are memory-mapped files that are not associated with a file on a disk. When the last process has finished working with the file, the data is lost and the file is reclaimed by garbage collection. These files are suitable for creating shared memory for inter-process communications (IPC).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM