Add pattern descriptionn on iterator pattern

This commit is contained in:
Petrutiu Mihai
2016-06-23 10:23:16 +03:00
parent 494e3650f9
commit 68f0822bfe

View File

@@ -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<T>, IEnumerable<T>, yield for creating IEnumerable<T>
Java: Iterator<E>, Iterable<E>";
}
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();
}
}
}