public void RemoveWagonFromTrain(int wagon_id, int station_id) { this.wagon_list.Remove(wagon_list.Find(delegate(Wagon wagon) { return(wagon.wagon_id == wagon_id); })); int index = FindIndexOfStation(station_id); Wagon w = Wagon.Find(wagon_id); wagons_by_station[index].Add(w); }
public void AddWagonToTrain(int wagon_id, int station_id) { Wagon wagon = Wagon.Find(wagon_id); wagon_list.Add(wagon); int index = FindIndexOfStation(station_id); this.wagons_by_station[index].Remove(wagons_by_station[index].Find(delegate(Wagon w) { return(w.wagon_id == wagon_id); })); }