Exemplo n.º 1
0
        public static Flyweight GetFlyweight(ExtrinsicState extrinsicState)
        {
            Flyweight flyweight = null;

            if (!pool1.ContainsKey(extrinsicState))
            {
                flyweight = new ConcreteFlyweight1();
                pool1.TryAdd(extrinsicState, flyweight);
            }
            else
            {
                pool1.TryGetValue(extrinsicState, out flyweight);
            }
            return(flyweight);
        }
Exemplo n.º 2
0
        public static Flyweight GetFlyweight(string Extrinsic)
        {
            Flyweight flyweight = null;

            if (pool.ContainsKey(Extrinsic))
            {
                pool.TryGetValue(Extrinsic, out flyweight);
            }
            else
            {
                flyweight = new ConcreteFlyweight1(Extrinsic);
                pool.TryAdd(Extrinsic, flyweight);
            }

            return(flyweight);
        }