How to create an xml file in the form of c# list.The list will be populated with the data from database.
Can any1 help me on this
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Sep 15, 2011, 12:35 AM EDT
Here's a simple example:
This code should produce the following XML file:
Sweety45 reputationPosted Sep 15, 2011, 12:51 AM EDT
VulpesRank #55 · 29.2K reputationPosted Sep 15, 2011, 8:11 AM EDT
and the code to serialize the list to disk will be the same as before.
Incidentally, you can write the datatable directly to an XML file, without going through a list at all, using the DataTable.WriteXml(fileName) method. It won't be quite the same as what we've done here but it should be good enough :)
Sam HobbsRank #108 · 20.5K reputationPosted Sep 15, 2011, 6:46 PM EDT
What is the purpsoe of the list?
I ask these things just to help us understand what you need. We are eager to help you but we need to understand.