public static PooledObject <T> GetPooledObject <T>(this ObjectPool <T> pool) where T : class { return(new PooledObject <T>(pool, p => p.Allocate(), (p, o) => p.Free(o))); }
public static PooledObject <List <TItem> > GetPooledObject <TItem>(this ObjectPool <List <TItem> > pool) { return(PooledObject <List <TItem> > .Create(pool)); }
public static PooledObject <StringBuilder> GetPooledObject(this ObjectPool <StringBuilder> pool) { return(PooledObject <StringBuilder> .Create(pool)); }
public static PooledObject <Dictionary <TKey, TValue> > GetPooledObject <TKey, TValue>(this ObjectPool <Dictionary <TKey, TValue> > pool) { return(PooledObject <Dictionary <TKey, TValue> > .Create(pool)); }
// implement Poolable object pattern #region "Poolable" private TextKeyedCache(ObjectPool <TextKeyedCache <T> > pool) { _pool = pool; _strings = new StringTable(); }