标签:orm player des for mod mode str 读取 使用
//使用序列化保存对象状态到存储介质
//添加[Serializable]
Game game = new Game();
game.Level = 2;
game.Player = "Tom";
FileStream fs = new FileStream(@"game.bin",FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs,game);
//使用反序列化从存储介质读取对象状态
Game game = new Game();
FileStream fs = new FileStream(@"game.bin",FileMode.Open,FileAccess.Read);
BinaryFormatter bf = new BinaryFormatter();
game = (Game)bf.Deserialize(fs);
标签:orm player des for mod mode str 读取 使用
原文地址:http://www.cnblogs.com/zwnet/p/6135648.html