Is there a way, in C# on Windows, to write a file and flag it as temporary so that the operating system won't bother physically writing it to disk? The file in question is small, and will be read by another program in the very near future, and deleted and rewritten very soon after that, so that keeping it purely in RAM would make sense.
I'm currently writing the file with File.WriteAllText but could use a different API if necessary.
MemoryMappedFilemsdn.microsoft.com/en-us/library/…FILE_ATTRIBUTE_TEMPORARYwhen creating the file, that serves as a strong hint to the file system not to bother writing it to disk. I don't know the best way to do that in C# though.FileOptionshad aTemporary = 256member, you could do this without P/Invoking toCreateFile, but in their wisdom the designers chose not to make this option available. (If you try to fudge it in, theFileStreamconstructor will complain.)