序列化分类:

(一)浅层序列化
XmlSerialization,是将对象的公共字段和属性或者方法的参数和返回值转换(序列化)为符合特定XML 架构定义语言(XSD) 文档的XML 流。
(二)深层序列化
BinaryFormatter和SoapFormatter,是将对象的公共字段和私有字段以及类的名称(包括包含该类的程序集)都被转换为字节流,然后写入数据流。

序列化图解:
序列化使用心得

浅层序列化:拷贝属性值到一个字节流的过程

序列化使用心得

深层序列化:拷贝对象数据到一个字节流的过程
序列化使用心得示例代码:
序列化使用心得ds.RemotingFormat 
= SerializationFormat.Binary;//序列化为二进制
序列化使用心得
BinaryFormatter bf = new BinaryFormatter ();
序列化使用心得StreamWriter swDat 
= new StreamWriter ("output_dataset.dat");
序列化使用心得bf.Serialize(swDat.BaseStream, ds);
序列化使用心得swDat.Close();

相关文章:

  • 2022-12-23
  • 2021-06-15
  • 2021-11-19
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-20
  • 2021-12-08
  • 2022-01-07
  • 2021-07-30
  • 2022-12-23
相关资源
相似解决方案