示例#1
0
 private static void Iterate(SN.IIterator iterator)
 {
     while (!iterator.isDone())
     {
         Console.WriteLine(string.Format("User Name : {0}", iterator.CurrentItem()));
         iterator.Next();
     }
 }
示例#2
0
        private static void IteratorPattern()
        {
            SN.ISocialNetwork faceBook         = new SN.FaceBook();
            SN.IIterator      faceBookIterator = faceBook.CreateIterator();
            Iterate(faceBookIterator);

            SN.ISocialNetwork twitter         = new SN.Twitter();
            SN.IIterator      twitterIterator = twitter.CreateIterator();
            Iterate(twitterIterator);
        }