You simply missed the /order
argument.
Try something like this: xsd /c /order your.xsd
The output would be distinguishable from what you have by virtue of additional Order values:
[System.Xml.Serialization.XmlElementAttribute("Start", typeof(System.DateTime), DataType="date", Order=2)]
[System.Xml.Serialization.XmlElementAttribute("Stop", typeof(System.DateTime), DataType="date", Order=2)]
[System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemsElementName")]
public System.DateTime[] Items {
get {
return this.itemsField;
}
set {
this.itemsField = value;
}
}
A simple test program such as this would correctly roundtrip your XML:
using System;
using System.IO;
using System.Xml.Serialization;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
XmlSerializer ser = new XmlSerializer(typeof(Entry));
Entry o;
using (Stream s = File.OpenRead(@"D:\...\representing-a-repeated-pair-of-xml-elements-in-xsd-2.xml"))
{
o = (Entry)ser.Deserialize(s);
}
using (Stream s = File.OpenWrite(@"D:\...\representing-a-repeated-pair-of-xml-elements-in-xsd-3.xml"))
{
ser.Serialize(s, o);
}
}
}
}