'Where and how save temporary files in WPF C# app
I am building a wpf c # application, at user request I download image files from DB (not designed by me). Where should I save these files so that I can open them later in the program?
Solution 1:[1]
The simplest way is to just call Path.GetTempPath. This will give you a writable folder that is your temp folder. If you are looking for something specific like a windows Special folder then something like
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
(or some other SpecialFolder value will do.
Solution 2:[2]
You can try adding a temp file like this:
string FileName = Path.GetTempFileName();
FileStream File_Stream = new FileStream(FileName, FileMode.Append,
FileAccess.Write);
//Do what you like with this file
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TJ Rockefeller |
| Solution 2 | Palisar |
