I've changed my approach and decided to start writing XML with Linq. I've readed some tutorials and was able to write with no problem.
However , i don't know how to write elements iterating over my array of lists.
I've a nested foreach:
foreach(List<xmldata> i in XMLList.XMLArrayList) {
foreach (var x in i) { } }
that i can use to access elements of my list. Since its an array of list ,
public class xmldata //Class to receive items list
{ public string xml_filename { get; set; }
public string colorname { get; set; }
public string colorvalues { get; set; } }
However, if i directly write x.colorname into the Linq as an XAttribute , in the next
i.e:
List[0][1]
colorname blue
colorvalue #434344
xml_filename filename
List[0][2]
colorname cyan
colorvalue #414354
List[0][3]
colorname magenta
colorvalue #43213
When the foreach loop finishes iterating over this position, the XML File is going to have only the magenta written. And i would like to have all values written (since it'll iterate over all list positions).
How can i achieve that ?
Thanks in advance.