diff --git a/DesignPattern/Iterator/Client.cs b/DesignPattern/Iterator/Client.cs
new file mode 100644
index 0000000..62eaf74
--- /dev/null
+++ b/DesignPattern/Iterator/Client.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Iterator
+{
+ internal class Client
+ {
+ public static void HowToTest()
+ {
+ IAggregate agg = new ColorAggregate();
+ IIterator iter = agg.GetIterator();
+
+ object c1 = iter.Next();
+ object c2 = iter.Next();
+ object c3 = iter.Next();
+
+ Console.WriteLine($"{c1}, {c2}, {c3}");
+ }
+ }
+}
diff --git a/DesignPattern/Iterator/ColorAggregate.cs b/DesignPattern/Iterator/ColorAggregate.cs
new file mode 100644
index 0000000..8cf46c9
--- /dev/null
+++ b/DesignPattern/Iterator/ColorAggregate.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Iterator
+{
+ internal class ColorAggregate : IAggregate
+ {
+ object[] colors = { "White", "Red", "Green", "Blue", "Black" };
+
+ public IIterator GetIterator()
+ {
+ return new CommonIterator(colors);
+ }
+
+ public int Count { get { return colors.Length; } }
+ }
+}
diff --git a/DesignPattern/Iterator/CommonIterator.cs b/DesignPattern/Iterator/CommonIterator.cs
new file mode 100644
index 0000000..47365c1
--- /dev/null
+++ b/DesignPattern/Iterator/CommonIterator.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Iterator
+{
+ internal class CommonIterator : IIterator
+ {
+ private object[] collection;
+ private int index;
+
+ public CommonIterator(object[] collection)
+ {
+ this.collection = collection;
+ this.index = -1;
+ }
+
+ public bool HasNext { get { return index + 1 < collection.Length; } }
+
+ public object Next()
+ {
+ if (HasNext)
+ {
+ index++;
+ return collection[index];
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/DesignPattern/Iterator/IAggregate.cs b/DesignPattern/Iterator/IAggregate.cs
new file mode 100644
index 0000000..570c35e
--- /dev/null
+++ b/DesignPattern/Iterator/IAggregate.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Iterator
+{
+ internal interface IAggregate
+ {
+ IIterator GetIterator();
+ }
+}
diff --git a/DesignPattern/Iterator/IIterator.cs b/DesignPattern/Iterator/IIterator.cs
new file mode 100644
index 0000000..6061f76
--- /dev/null
+++ b/DesignPattern/Iterator/IIterator.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Iterator
+{
+ internal interface IIterator
+ {
+ bool HasNext { get; }
+
+ object Next();
+ }
+}
diff --git a/DesignPattern/Iterator/Iterator.csproj b/DesignPattern/Iterator/Iterator.csproj
index e03ce46..cc1273a 100644
--- a/DesignPattern/Iterator/Iterator.csproj
+++ b/DesignPattern/Iterator/Iterator.csproj
@@ -43,6 +43,11 @@
+
+
+
+
+
diff --git a/DesignPattern/Iterator/Program.cs b/DesignPattern/Iterator/Program.cs
index 2a89267..764fd48 100644
--- a/DesignPattern/Iterator/Program.cs
+++ b/DesignPattern/Iterator/Program.cs
@@ -16,6 +16,9 @@ namespace Iterator
{
static void Main(string[] args)
{
+ Client.HowToTest();
+
+ Console.ReadKey();
}
}
}