public void SerializeObject(string filename, Hiihtokilpailu objectToSerialize) { Stream stream = File.Open(filename, FileMode.Create); BinaryFormatter bFormatter = new BinaryFormatter(); bFormatter.Serialize(stream, objectToSerialize); stream.Close(); }
private void tuoTiedotToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.ShowDialog(); Serializer ser = new Serializer(); kilpailu = ser.DeSerializeObject(dialog.FileName); }