Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

saving state between program restarts

Tags:

c#

.net

How can I declare a variable which would save sting forever?

I mean if the user closes and restarts the program, this string value is not lost.

How can this be done?

like image 265
Irakli Lekishvili Avatar asked Dec 29 '25 06:12

Irakli Lekishvili


2 Answers

There are a number of different ways to store state for an application. The approach really depends on the type of data you are storing and other requirements

Options

  • Use the Settings classes built into .NET
    • http://msdn.microsoft.com/en-us/library/aa730869(v=VS.80).aspx
  • Store the data in some type of file or database
  • Send the data to a webservice or the cloud
like image 146
ccozad Avatar answered Dec 30 '25 20:12

ccozad


Save the variable value to a database or other storage.

like image 27
Orn Kristjansson Avatar answered Dec 30 '25 19:12

Orn Kristjansson