0down votefavorite | 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: Code Code that i can use to access elements of my list. Since its an array of list , each position of the array is going to have a list with three elements from this class: Code Code Code Code However, if i directly write x.colorname into the Linq as an XAttribute , in the next iteration it'll overwrite its value and in the end the fill will have only the last element. i.e: Code Code Code Code Code Code Code Code Code Code Code Code 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. |
Answers
Know the answer? Post it. Somebody with the same question will find it here.