Search code examples
c#memorysavevirtual

Saving Files in to the memory/virtual file C#


Is there any possibilities to save a file to a virtual folder or something. I use a method, which needs a string(path,where to save the file) as parameter to save the content. But i just want to save the file into the memory.Can I programmatically create a virtual folder/path?


Solution

  • If your component want to recevice a file, you need a file on your HDD/SSD. In those cases, i prefer to use the APP-Data folder and create a sub directory in it. It is accessable over: Environment.SpecialFolder.LocalApplicationData.

    To come back to your question, it is not possible. Because the method you want to use, will take the os file system.

    The only in memory solution would be, if there is an overload which accept a MemoryStream or just a Stream.