diff --git a/src/IteratorPattern/IteratorPatternExamples.cs b/src/IteratorPattern/IteratorPatternExamples.cs index 2983354..b860192 100644 --- a/src/IteratorPattern/IteratorPatternExamples.cs +++ b/src/IteratorPattern/IteratorPatternExamples.cs @@ -1,15 +1,18 @@ using IteratorPattern.FileExample; using IteratorPattern.TVExample.TVEnumerable; using IteratorPattern.TvIterator; +using System; namespace IteratorPattern { - // This project can output the Class library as a NuGet Package. - // To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build". public class IteratorPatternExamples { public static void Run() { + Console.WriteLine(GetPatternDescription()); + Console.WriteLine(GetActors()); + GoToNextStep(); + TVIteratorExample tvIteratorExample = new TVIteratorExample(); tvIteratorExample.Run(); @@ -21,5 +24,28 @@ namespace IteratorPattern //Iterator that selects in batches } + + public static string GetPatternDescription() + { + return @"Pattern description: +In object-oriented programming, the iterator pattern is a design pattern in which an iterator is used to traverse a container and access the container's elements. +C# interfaces helpers for Iterator pattern: IEnumerator, IEnumerable, yield for creating IEnumerable +Java: Iterator, Iterable"; + } + + public static string GetActors() + { + return @"Actors: +Iterator: interface with hasNext/next/current methods or variantions from this +Concrete interator: concrete class that implements Iterator +Aggregate: interface for returning the iterator +Concrete aggregate: imlpementation of aggregate"; + } + + private static void GoToNextStep() + { + Console.ReadKey(); + Console.Clear(); + } } }