Exemple #1
0
 public void SaveMapToFile(string filename)
 {
     map.ClearAttachment();
     //Create the file.
     using (FileStream fs = File.Create(filename))
     {
         map.ClearArray();//清空数组内容再存储,以节省存储空间
         BinaryFormatter formatter = new BinaryFormatter();
         formatter.Serialize(fs, map);
         fs.Close();
         map.RestoreArrayFromList();//从List恢复内容到数组
     }
 }