private List<Line> GiveLinesPlyingThroughTwoBusStops(BusStop firstBusStop, BusStop secondBusStop) { List<Line> linesPlyingThroughStartBusStop = firstBusStop.LinesPlyingThroughBusStop; List<Line> linesPlyingThroughEndBusStop = secondBusStop.LinesPlyingThroughBusStop; List<Line> linesPlyingThroughBothBusStops = new List<Line>(); foreach (Line lineFromStartBusStop in linesPlyingThroughStartBusStop) { foreach (Line lineFromEndBusStop in linesPlyingThroughEndBusStop) { if (lineFromStartBusStop.Number.Equals(lineFromEndBusStop.Number)) { linesPlyingThroughBothBusStops.Add(lineFromStartBusStop); break; } } } return linesPlyingThroughBothBusStops; }
private void FindStartAndEndBusStop(ref BusStop startBusStop, ref BusStop endBusStop, string startBusStopName, string endBusStopName, List<BusStop> busStops) { foreach (BusStop busStop in busStops) { if (startBusStopName.Equals(busStop.BusStopName)) { startBusStop = busStop; } else if (endBusStopName.Equals(busStop.BusStopName)) { endBusStop = busStop; } } }