static void Main(string[] args) { BooksCollection books = new BooksCollection(); for (IIterator iter = books.createIterator(); iter.hasNext();) { string name = iter.next().ToString(); Console.WriteLine("BookName : " + name); } }
static void Main(string[] args) { BooksCollection books = new BooksCollection(); books.AddBook("Гарри Поттер"); books.AddBook("Собачье сердце"); books.AddBook("Война и Мир"); var enumerator = books.GetEnumerator(); enumerator.MoveNext(); Console.WriteLine(enumerator.Current); enumerator.MoveNext(); Console.WriteLine(enumerator.Current); enumerator.MoveNext(); Console.WriteLine(enumerator.Current); enumerator.MovePrev(); Console.WriteLine(enumerator.Current); }