【发布时间】:2013-06-04 18:09:08
【问题描述】:
我有以下课程和包含它的列表:
public class Transport
{
public string TransportType { get; set; }
public string Mode { get; set; }
public class Coordinates
{
public float ID { get; set; }
public float LocX { get; set; }
public float LocY { get; set; }
public float LocZ { get; set; }
public ObjectState State { get; set; }
public List<int[]> Connections = new <int[]>();
}
}
public enum ObjectState
{
Fly,
Ground,
Water
}
public static List<Transport> Tracking = new List<Transport>();
如何将 Tracking 序列化为 XML?
我知道我可以在列表中使用 [Serializable] 并将其序列化到文件中,但我不确定如何将其定义为保存为 XML。
【问题讨论】:
标签: c# xml-serialization