Example #1
0
        public SimpleObjectPool <T> GetObjectPool <T>() where T : new()
        {
            object objectPool;
            var    type = typeof(T);

            if (!mObjectPools.TryGetValue(type, out objectPool))
            {
                objectPool = new SimpleObjectPool <T>(() => new T());
                mObjectPools.Add(type, objectPool);
            }

            return((SimpleObjectPool <T>)objectPool);
        }
Example #2
0
 public void RegisterCustomObjectPool <T>(SimpleObjectPool <T> simpleObjectPool)
 {
     mObjectPools.Add(typeof(T), simpleObjectPool);
 }