3.1 从可串行化的类中定制XML串行化 1.格式化XML文档元素 [XmlRoot(ElementName = "Pupil", Namespace = "urn:MyNamespace")] public class Student { //则生成XML文档中,根元素 } 2.格式化XML元素 [XmlE... Read More
posted @ 2007-10-19 12:07 包建强 Views(1207) Comments(1) Diggs(0) Edit
深串行化:串行化对象的整个状态 使用命名空间: using System.IO; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Soap; 串行化类的标志:在... Read More
posted @ 2007-10-19 09:49 包建强 Views(1070) Comments(0) Diggs(1) Edit
浅串行化:只串行化类的公共字段和属性 公共属性必须是可读且可写的 使用命名空间:using System.Xml.Serialization; 以Book类为例: 串行化模板: public void SerializeIt(string filename) { XmlSerializer serialize... Read More
posted @ 2007-10-19 00:01 包建强 Views(876) Comments(0) Diggs(0) Edit