I'd like to have a base class that implements the majority of this example, and inherit for the parts that differ. All messages are the same except for the message node, which can be very different. Anyone know how to do this?
[XmlRoot("Package")]
public class Package
{
[XmlElement("Parameters")]
public parameters Parameters;
public class parameters
{
[XmlElement("MessageType")]
public string MessageType { get; set; }
[XmlElement("CreationDateTime")]
public string CreationDateTime { get; set; }
//etc...
}
[XmlElement("Message")]
public message Message;
public class message
{
// here I want different message types
// hopefully through inheritance
}
}
For example, I want this sometimes...
<Package>
<Parameters>
<MessageType></MessageType>
<CreationDateTime></CreationDateTime>
<MessageId></MessageId>
</Parameters>
<Message>
<MessageTypeRequest>
<etc1></etc1>
<etc2></etc2>
</MessageTypeRequest>
</Message>
</Package>
... but I want this at other times.
<Package>
<Parameters>
<MessageType></MessageType>
<CreationDateTime></CreationDateTime>
<MessageId></MessageId>
</Parameters>
<Message>
<MessageTypeResponse>
<etc1></etc1>
<etc2></etc2>
</MessageTypeResponse>
</Message>
</Package>