Custom Array Item Name for DTO

stimefire

New Member
One of my clients has XML data he wants to send to a service we are creating. A sample message might look like:\[code\]<SomeRootElement> <Dates> <Date>2012-05-20T00:00:00</Date> <Date>2012-05-21T00:00:00</Date> </Dates></SomeRootElement>\[/code\]I have a corresponding type defined as a \[code\]DataContract\[/code\] on my WCF service application:\[code\][DataContract]public class SomeRootElement { [DataMember] public ICollection<DateTime> Dates { get; set; }}\[/code\]The trouble is that based on this definition, WCF wants the \[code\]Dates\[/code\] collection to look like:\[code\]<Dates> <dateTime>2012-05-20T00:00:00</dateTime> <dateTime>2012-05-21T00:00:00</dateTime></Dates>\[/code\]Is there any way to influence the array item's serialized element name? This used to be easy using XML serialization attributes, but the \[code\]DataContractSerializer\[/code\] ignores those.
 
Back
Top