In C#, I have the following list:
List<string> FruitList`
I want use XMLSerializer to serialize it into a XML file with the following format:
<FruitList>
<Fruit>Apple</Fruit>
<Fruit>Orange</Fruit>
</FruitList>
The best case I've done is:
public class FruitList
{
[XmlArrayItem("Fruit")]
public List<string> Fruits = new List<string>();
}
The output looks like:
<FruitList>
<Fruits>
<Fruit>Apple</Fruit>
<Fruit>Orange</Fruit>
<Fruits>
</FruitList>
I want to remove the <Fruits> layer. Is it possible?
No comments:
Post a Comment