Example #1
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));
            }
        }
Example #2
0
 public string GetFont(CharacterContext ctx)
 {
     return(ctx.GetFont());
 }
Example #3
0
 public void SetFont(CharacterContext ctx)
 {
     ctx.SetFont("NewFont");
 }