Reputation: 4144
Using C#, I am trying to serialize XML into this string:
<root>
<IncludeRetElement>TxnID</IncludeRetElement>
<IncludeRetElement>TimeCreated</IncludeRetElement>
<IncludeRetElement>TimeModified</IncludeRetElement>
<IncludeRetElement>EditSequence</IncludeRetElement>
<IncludeRetElement>TxnNumber</IncludeRetElement>
<IncludeRetElement>CustomerRef</IncludeRetElement>
</root>
What must my class look like? I don't believe this would work:
public class Root
{
List<string> IncludeRetElement = new List<string>();
}
When I serialize, do I need to add special arguments to the XMLSerializer object?
Upvotes: 2
Views: 3187
Reputation: 735
This should work:
[XmlElement("IncludeRetElement")]
public string[] IncludeRetElement { get; set; }
Upvotes: 7