2 using System.Collections.Generic;
8 Func<T> _factoryMethod;
9 Action<T> _resetMethod;
12 public ObjectPool(Func<T> factoryMethod, Action<T> resetMethod = null) {
13 _factoryMethod = factoryMethod;
14 _resetMethod = resetMethod;
15 _pool =
new Stack<T>();
19 return _pool.Count == 0
24 public void Push(T obj) {
25 if(_resetMethod != null) {