我的应用程序中有一个“Gesture”类列表:
List<Gesture> gestures = new List<Gesture>();
这些手势类非常简单:
public class Gesture { public String Name { get; set; } public List<Point> Points { get; set; } public List<Point> TransformedPoints { get; set; } public Gesture(List<Point> Points,String Name) { this.Points = new List<Point>(Points); this.Name = Name; } }
我想允许用户将“手势”的当前状态保存到文件中,并且还能够加载包含手势数据的文件.
在C#中执行此操作的标准方法是什么?
解决方法
看一下.net中的XmlSerializer类型和XmlSerialization
在这里……找到了一个可以满足你需求的例子
http://www.switchonthecode.com/tutorials/csharp-tutorial-xml-serialization