public Flyweight GetFlyweight(string key)
        {
            if (!flyweights.ContainsKey(key))
            {
                switch (key)
                {
                    case "A":
                    {
                        flyweights[key] = new FlyweightA();
                        break;
                    }
                    case "B":
                    {
                        flyweights[key] = new FlyweightB();
                        break;
                    }
                }
            }

            return flyweights[key];
        }
Esempio n. 2
0
        public Flyweight GetFlyweight(string key)
        {
            if (!flyweights.ContainsKey(key))
            {
                switch (key)
                {
                case "A":
                {
                    flyweights[key] = new FlyweightA();
                    break;
                }

                case "B":
                {
                    flyweights[key] = new FlyweightB();
                    break;
                }
                }
            }

            return(flyweights[key]);
        }