Exemple #1
0
        public void Push(IRecyclableObject obj)
        {
            string type = obj.GetRecycleType();
            Stack <IRecyclableObject> stackIdleObject = m_poolIdleObject[type];

            if (stackIdleObject == null)
            {
                stackIdleObject = new Stack <IRecyclableObject>();
                m_poolIdleObject.Add(type, stackIdleObject);
            }
            stackIdleObject.Push(obj);
        }
Exemple #2
0
        public void Push(IRecyclableObject obj)
        {
            if (obj == null)
            {
                return;
            }

            string type = obj.GetRecycleType();
            Stack <IRecyclableObject> idleObjStack;

            if (m_idleObjPool.ContainsKey(type))
            {
                idleObjStack = m_idleObjPool[type];
            }
            else
            {
                idleObjStack = new Stack <IRecyclableObject>();
                m_idleObjPool.Add(type, idleObjStack);
            }

            idleObjStack.Push(obj);
        }