Spider024

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
01.using System.IO;  
02.using System.Runtime.Serialization.Formatters.Binary;  
03.....  
04....  
05.  
06.Hashtable aa = new Hashtable();  
07.  
08.private void buttonSave_Click(object sender, EventArgs e)  
09.{  
10.    FileStream fs = new FileStream("e:\\aa.dat", FileMode.Create);  
11.    BinaryFormatter bf = new BinaryFormatter();  
12.    bf.Serialize(fs, aa);  
13.    fs.Close();  
14.}  
15.  
16.private void buttonLoad_Click(object sender, EventArgs e)  
17.{  
18.    aa.Clear();  
19.    FileStream fs = new FileStream("e:\\aa.dat", FileMode.OpenOrCreate);  
20.    BinaryFormatter bf = new BinaryFormatter();  
21.    aa = (Hashtable)bf.Deserialize(fs);  
22.    fs.Close();  
23.}  

 

posted on 2013-04-11 09:59  Spider024  阅读(302)  评论(0编辑  收藏  举报