Reputation: 73908
I have a WPF application, when the app runs I need to store a variable in a shared memory. When the app is being closed and successively restart I need to get the variable previously stored. I need a simple solution, I would avoid using a text file saved in some place. If the machine is restarted I do now need to get that variable.
Any idea what are my option?
Upvotes: 3
Views: 755
Reputation: 10507
If you're wanting to avoid writing/reading files, you could use the Registry
.
Upvotes: 0
Reputation: 5163
You could use your Settings file to save properties between application sessions.
For more information see this and note the Saving User Settings at Run Time section. It technically is "saved" to a file, but in a much dev-friendly manner.
Edit: That is a link for VS2005, oops! Use ConfigurationManager.AppSettings and refer to this post when saving for newer apps.
Upvotes: 2