BinaryFormatter
以二进制格式序列化和反序列化对象或连接对象的整个图形。
以下样例实现了对象的序列化,反序列化,深拷贝
using System;
using System.IO;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
namespace BinaryFormatterExample
{
class Program
{
static void Main(string[] args)
{
List<Student> students = new List<Student>() {
new Student() {
Id=1,Name="Tom",Age=5,Desc="desc" },
new Student() {
Id=2,Name="Jack",Age=2,Desc="desc" },
new Student() {
Id=3,Name="Harry",Age=10 ,