If the data is very, very simple, and you need it to be readable by other applications or users (with the appropriate permissions), I would probably want to save it in an XML file or even in a text file inside the userβs application data folder, which will be obtained through Environment.GetFolderPath . An example save might look like this:
using System.IO; using System.Xml.Linq; string settingsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); if (!Directory.Exists(settingsDirectory)) Directory.CreateDirectory(settingsDirectory); string fileName = "tasks.xml"; string settingsPath = Path.Combine(settingsDirectory, fileName); XDocument settingsDoc = new XDocument( new XElement("Tasks", new XElement("Task", new XElement("Name", "Make Breakfast"), new XElement("Location", @"C:\Program Files\MyApp\Plugins"), new XElement("FileName", "breakfast.dll"))));
What is it - the settings are saved! You can load them again using XDocument.Load .
Aaronaught
source share