Exemplo n.º 1
0
        public static FlyWeightFactory GetInstance()
        {
            if (_flyWeightFactoryInstance == null)
            {
                _flyWeightFactoryInstance = new FlyWeightFactory();
            }

            return(_flyWeightFactoryInstance);
        }
Exemplo n.º 2
0
        public static void Run()
        {
            string           text = " This is some random text. This needs to be represented in flyweight format";
            CharacterContext ctx  = new CharacterContext();

            foreach (Char c in text)
            {
                FlyWeightCharacter fc = FlyWeightFactory.GetInstance().GetCharacter(c);
                Console.WriteLine(fc.GetFont(ctx));
            }
        }