Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var bookShelf = new BookShelf();

            bookShelf.AppendBook(new Book {
                Name = "Around the World in 80 Days"
            });
            bookShelf.AppendBook(new Book {
                Name = "Bible"
            });
            bookShelf.AppendBook(new Book {
                Name = "Cinderella"
            });
            bookShelf.AppendBook(new Book {
                Name = "Daddy-Long-Legs"
            });
            var iterator = bookShelf.GetIterator();

            while (iterator.HasNext)
            {
                var book = (Book)iterator.Next();
                Console.WriteLine(book.Name);
            }
            Console.ReadLine();
        }
Exemplo n.º 2
0
 public BookShelfIterator(BookShelf bookShelf)
 {
     _bookShelf = bookShelf;
 }