展开全部
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
....
...
Hashtable aa = new Hashtable();
private void buttonSave_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("e:\\aa.dat", FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, aa);
fs.Close();
}
private void buttonLoad_Click(object sender, EventArgs e)
{
aa.Clear();
FileStream fs = new FileStream("e:\\aa.dat", FileMode.OpenOrCreate);
BinaryFormatter bf = new BinaryFormatter();
aa = (Hashtable)bf.Deserialize(fs);
fs.Close();
}
using System.Runtime.Serialization.Formatters.Binary;
....
...
Hashtable aa = new Hashtable();
private void buttonSave_Click(object sender, EventArgs e)
{
FileStream fs = new FileStream("e:\\aa.dat", FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs, aa);
fs.Close();
}
private void buttonLoad_Click(object sender, EventArgs e)
{
aa.Clear();
FileStream fs = new FileStream("e:\\aa.dat", FileMode.OpenOrCreate);
BinaryFormatter bf = new BinaryFormatter();
aa = (Hashtable)bf.Deserialize(fs);
fs.Close();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询