Exemplo n.º 1
0
 public static PooledObject <T> GetPooledObject <T>([NotNull] this ObjectPool <T> pool) where T : class =>
 new PooledObject <T>(pool);
Exemplo n.º 2
0
 public static PooledObject <List <TItem> > GetPooledObject <TItem>([NotNull] this ObjectPool <List <TItem> > pool) =>
 new PooledObject <List <TItem> >(pool, p => p.AllocateAndClear(), (p, obj) => p.ClearAndFree(obj));
Exemplo n.º 3
0
 public static PooledObject <StringBuilder> GetPooledObject([NotNull] this ObjectPool <StringBuilder> pool) =>
 new PooledObject <StringBuilder>(pool, p => p.AllocateAndClear(), (p, sb) => p.ClearAndFree(sb));
Exemplo n.º 4
0
 public static PooledObject <Dictionary <TKey, TValue> > GetPooledObject <TKey, TValue>([NotNull] this ObjectPool <Dictionary <TKey, TValue> > pool) =>
 new PooledObject <Dictionary <TKey, TValue> >(pool, p => p.AllocateAndClear(), (p, obj) => p.ClearAndFree(obj));
Exemplo n.º 5
0
 public static PooledObject <T> GetPooledObject <T>([NotNull] this ObjectPool <T> pool, [NotNull] Action <ObjectPool <T>, T> releaser) where T : class =>
 new PooledObject <T>(pool, releaser);