public static void Test() { HashSet <string> colors = new HashSet <string> { "red", "green", "blue" }; HashSet <string> shades = new HashSet <string> { "pale", "dark", "light" }; FlyweightFactory factory = new FlyweightFactory(); foreach (string s in shades) { foreach (string c in colors) { Flyweight flyweight = factory.GetFlyweight(c); System.Console.WriteLine(flyweight.DoSomething(s)); } } System.Console.WriteLine("Number of Flyweights: " + factory.GetFlyweightsNumber()); }