0

Data storage in program

Hi everyone, I'm quite new to developing software in C# and would like to know how to store one or more variables that retain on closing the program. For example I ask a user to enter his name and when I close the program and open it again I can give the commando to show the name again. Which options does a programmer have to store variables. Is there any good article about this topic? Thanks!

29th Sep 2018, 10:39 PM
Yannick Bollen
Yannick Bollen - avatar
3 Réponses
+ 1
You either write the data to a file (i suggest you try this first) or you write the data to a database. Method 1 open a textwriter write it out close the textwriter
30th Sep 2018, 2:30 AM
Nestor
+ 1
Look at settings in c# you can save alle kind of user settings and restoren them at the start. https://msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx https://www.dotnetperls.com/settings https://www.codeproject.com/Articles/17659/How-To-Use-the-Settings-Class-in-C
30th Sep 2018, 9:16 PM
sneeze
sneeze - avatar
0
I agree that storing one variable in a setting is the most easy way to solve this problem. However I would like to see something more in the direction of using Json, XML file or even by using a DLL which will read out on starting up and that can be adjusted when entering a value.
1st Oct 2018, 5:29 AM
Yannick Bollen
Yannick Bollen - avatar