Writing Out LINQ to XML Documents to CSV Text Files
Posted on November 1st, 2008 by Patrick Stuart
This may sound stupid, but I wanted to store some text parsing I was doing for some VDP projects in LINQ to XML XDocuments.
So, I created the following:
XDocument recs = new XDocument();
XElement records1 = new XElement(”Records”);
XElement record1 = new XElement(”Record”);
record1.Add(new XElement(”id”, “1″),
new XElement(”Name”,”Test”),
new XElement(”Address”,”123 Anywhere”)
);
records1.Add(record1);
recs.Add(records1);
which should create an xml document looking like this:
<Records>
<Record>
[...]








