XmlSerializer question

  • Thread starter Thread starter Dirk Reske
  • Start date Start date
D

Dirk Reske

Hello,

how can I create following file with the Serializer?

<xml ...>
<Items>
<Item Key="1">Item 1</Item>
<Item Key="2">Item 2</Item>
...
</Items>
</xml>
 
You could do it as follows:

[XmlRoot("Item")]
class Item
{
[XmlAttribute("Key")]
public string Key;

[XmlText]
public string Value;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top