public SimpleObjectPool(Func <T> factoryMethod, Action <T> resetMethod = null, int initCount = 0) { MFactory = new CustomObjectFactory <T>(factoryMethod); _mResetMethod = resetMethod; for (var i = 0; i < initCount; i++) { MCacheStack.Push(MFactory.Create()); } }
public override bool Recycle(T obj) { if (_mResetMethod != null) { _mResetMethod(obj); } MCacheStack.Push(obj); return(true); }