public void SerializeObject(string filename, SaveData objectToSerialize) { if (File.Exists(filename)) { File.Delete(filename); } Stream stream = File.Open(filename, FileMode.Create); BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(stream, objectToSerialize); stream.Close(); }
public static SaveData GetInstance() { return sInstance ?? (sInstance = new SaveData()); }