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];
        }
示例#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]);
        }