public Form1() { formatter = new BinaryFormatter(); Form1.form = this; this.vehicleListOfStrings = new List <String>(); this.vehicleList = new VehicleList(); InitializeComponent(); this.vehicle_list.DataSource = this.vehicleListOfStrings; }
private void deserialize_Click(object sender, EventArgs e) { vehicleList = null; using (FileStream fs = new FileStream("pops.bin", FileMode.OpenOrCreate)) { vehicleList = (VehicleList)formatter.Deserialize(fs); for (int i = 0; i < vehicleList.Size(); i++) { vehicleListOfStrings.Add(vehicleList.Get(i).GetString()); } } this.updateVehicleList(); }