public static FlyWeightFactory GetInstance() { if (_flyWeightFactoryInstance == null) { _flyWeightFactoryInstance = new FlyWeightFactory(); } return(_flyWeightFactoryInstance); }
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)); } }