How to create File with the FILE_ATTRIBUTE_TEMPORARY in C#? (So to store Data in Ram but be able to use it as normal file)
+1
A:
I believe you'll have to use P/Invoke to call the native CreateFile
then use the FileStream(SafeFileHandle, FileAccess) constructor on FileStream
. MSDN has a sample for how to use SafeFileHandle and CreateFile together.
Dean Harding
2010-05-30 23:48:47
Thanks for pointing out my (C++ to C#) error within answering the question! :)
Secko
2010-05-31 00:13:30
+2
A:
Memory mapped files are an alternative, and are built into C# 4.0:
http://msdn.microsoft.com/en-us/library/system.io.memorymappedfiles.memorymappedfile.aspx
chibacity
2010-05-30 23:53:04