using System.Collections.Generic;
using System.Xml.Serialization;
public static class Program
public static void Main(string[] args)
var product = new Product
Values = new List<object>
new Value {AttributeId = "ATTR-7196", Text = "201607280755"},
new Value {AttributeId = "ATTR-6236", Text = "PTFE 125 + 25% GF, Platte"},
new Value {Text = "PLATTE"},
new Value {Text = "LUBRIFLON 225"},
new Value {Text = "PLAQUE"},
new Value {Text = "LUBRIFLON 22"},
var s = new XmlSerializer(typeof(Product));
using (var writer = new StringWriter())
s.Serialize(writer, product);
Console.WriteLine(writer.ToString());
public string Id { get; set; }
[XmlAttribute("UserTypeID")]
public string UserTypeId { get; set; }
[XmlArrayItem("Value", typeof(Value))]
[XmlArrayItem("MultiValue", typeof(MultiValue))]
public List<object> Values { get; set; }
[XmlElement(ElementName = "Value")]
public List<Value> Values { get; set; }
[XmlAttribute("AttributeID")]
public string AttributeId { get; set; }
public string Text { get; set; }