示例#1
0
 public static PooledObject <T> GetPooledObject <T>([NotNull] this ObjectPool <T> pool) where T : class =>
 new PooledObject <T>(pool);
示例#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));
示例#3
0
 public static PooledObject <StringBuilder> GetPooledObject([NotNull] this ObjectPool <StringBuilder> pool) =>
 new PooledObject <StringBuilder>(pool, p => p.AllocateAndClear(), (p, sb) => p.ClearAndFree(sb));
示例#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));
示例#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);