public void SomeMethod(IHasSightsNearby sightseeing) { var walkingIterator = sightseeing.GetWalkingIterator(); while (walkingIterator.MoveNext()) { var anotherSightseeing = walkingIterator.Current; // do smth with anotherSightseeing } }
public static IIterator <IHasSightsNearby> GetWalkingIterator(this IHasSightsNearby sightseeing) { return(new WalkingIterator(sightseeing)); }
public static IIterator <IHasSightsNearby> GetTrainIterator(this IHasSightsNearby sightseeing) { throw new NotImplementedException(); }