1
using System;2
using System.Collections.Generic;3
using System.Text;4
using System.IO;5
using System.Runtime.Serialization.Formatters.Binary;6

7
namespace SerializeTest8


{9
[Serializable]10
class A11

{12

13
}14
class Program15

{16
static void Main(string[] args)17

{18
try19

{20
A a = new A();21
FileStream fs = new FileStream("D:\\A.mdy", FileMode.Create);22
BinaryFormatter bf = new BinaryFormatter();23
bf.Serialize(fs, a);24
}25
catch(Exception ex)26

{27
Console.Write(ex.Message);28
}29
}30
}31
}32

浙公网安备 33010602011771号