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); }
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); }