예제 #1
0
        /// <summary>
        /// The test first.
        /// </summary>
        private static void TestFirst()
        {
            // Build a document with text
            const string Document = "AAZZBBZB";

            char[]           chars            = Document.ToCharArray();
            CharacterFactory characterFactory = new CharacterFactory();

            // extrinsic state
            int pointSize = 10;

            // For each character use a flyweight object
            foreach (char c in chars)
            {
                pointSize++;
                AbstractCharacter abstractCharacter = characterFactory.GetCharacter(c);
                abstractCharacter.Display(pointSize);
            }

            // Wait for user
            Console.ReadKey();
        }