/// <summary> /// Gets the leg after the specified leg. /// </summary> /// <param name="leg">leg</param> /// <returns>The next leg, or null if this is the last leg.</returns> internal Leg NextLeg(Leg leg) { for (var it = Legs.GetEnumerator(); it.MoveNext();) { if (it.Current.sameValueAs(leg)) { return(it.MoveNext() ? it.Current : null); } } return(null); }
public Leg NextOf(UnLocode location) { var next = (Leg)null; var currentFound = false; using (var en = Legs.GetEnumerator()) while (en.MoveNext()) { if (currentFound) { next = en.Current; break; } if (en.Current.LoadLocation.Equals(location) || en.Current.UnloadLocation.Equals(location)) { currentFound = true; } } return(next); }