コード例 #1
0
ファイル: a.cs プロジェクト: PlumpMath/designpattern-980
/// <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
ファイル: MainApp.cs プロジェクト: ronymaychan/demos
        /// <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();
        }