Пример #1
0
/// <summary>
/// Entry point into console application.
/// </summary>
        static void Main()
        {
// Build a document with text
            string document = "AAZZBBZB";

            char[] chars = document.ToCharArray();

            CharacterFactory factory = new CharacterFactory();

// extrinsic state
            int pointSize = 10;

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

// Wait for user
            Console.ReadKey();
        }
Пример #2
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            // Build a document with text
            string document = "AAZZBBZB";
            char[] chars = document.ToCharArray();

            CharacterFactory factory = new CharacterFactory();

            // extrinsic state
            int pointSize = 10;

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

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