I'm still getting to grips with C# and I've been looking for ages to try and find a solution to my problem. (This is a practice project to help me learn C#)
I am able to create and write to a XML Settings file but I'm struggling getting the data from it.
I tried using the top answer from here but it didn't work.
I would like to get both the element and inner text from the XML file and into a 2 columned list (I'm currently using a dictionary and I'm open to change this if I have/need to)
In the first column I'd like the element name, and the second, the inner text.
I would then simply just like to write out the list I've created
XML
<settings>
<view1>enabled</view1>
<view2>disabled</view2>
</settings>
C#
private Dictionary<string, string> settingsList = new Dictionary<string, string>();
private void CreateSettings()
{
XDocument xmlSettings = new XDocument(
new XElement(
"settings",
new XElement("view1", "enabled"),
new XElement("view2", "disabled")))
xmlSettings.Save(FilePath);
}
private void ReadSettings
{
XDocument xmlSettings = XDocument.Load(FilePath);
//READ XML FROM FILE PATH AND ADD TO LIST
}