I have the following structure in C#:
[Serializable]
public struct Line
{
public Line(Point startPoint, Point endPoint)
{
StartPoint = startPoint;
EndPoint = endPoint;
}
public Point StartPoint;
public Point EndPoint;
}
which I use in another class, that is XmlSerializable
[XmlRootAttribute("Drawing")]
public Drawing
{
[XmlElement("Line")]
List<Line> lines;
//other members...
}
By serializing the Drawing class, I get an xml that describes a Line like this:
<Line>
<StartPoint>
<X>13</X>
<Y>33</Y>
</StartPoint>
<EndPoint>
<X>43</X>
<Y>63</Y>
</EndPoint>
</Line>
Is there any way of specifying the xml serialization tags so that a Line is generated in this format:
<Line StartPointX="13" StartPointY="33" EndPointX="43" EndPointY="63"/>