static void Main(string[] args) { NameRepository nameRepository = new NameRepository(); IIterator iterator = nameRepository.GetIterator(); while (iterator.HasNext()) { string name = (string)iterator.Next(); Console.WriteLine("Name : " + name); } }
static void Main(string[] args) { NameRepository nameRepository = new NameRepository(); for (IIterator iterator = nameRepository.GetIterator(); iterator.HasNext();) { string name = (string)iterator.Next(); Console.WriteLine("Name is: " + name); } Console.ReadKey(); }