public List<Wish> GetAllWishes() { var wishes = new WishList(); wishes.AddOrFailIfExists(RuntimeWishes, 0); wishes.AddOrFailIfExists(ProvidedWishes, 0); wishes.AddOrFailIfExists(OptionalWishes, 0); wishes.AddOrFailIfExists(TransitiveWishes, 0); IncludeAllTransitivesOf(wishes, 0, wishes.ToList()); return wishes.ToList(); }
private void IncludeTransitivesOf(WishList addTo, int depth, Wish wish) { foreach (var child in wish.TransitiveWishes) { addTo.AddOrFailIfExists(child); IncludeTransitivesOf(addTo, depth + 1, child); } }