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!
3 Respuestas
+ 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
+ 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
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.