public Form1() { InitializeComponent(); _joe = new Guy(); _bob = new Guy(); _joe.Name = "Joe"; _bob.Name = "Bob"; _joe.Cash = 50; _bob.Cash = 100; _bank = 100; UpdateForm(); }
private void loadJoeButton_Click(object sender, EventArgs e) { using (Stream input = File.OpenRead("Guy_file.dat")) { BinaryFormatter formatter = new BinaryFormatter(); _joe = (Guy)formatter.Deserialize(input); } UpdateForm(); }