예제 #1
0
 public static List <T> ReturnAndFree(List <T> list)
 {
     SharedPools.Default <List <T> >().ForgetTrackedObject(list);
     return(list);
 }
예제 #2
0
 public static void Free(List <T> list)
 {
     SharedPools.Default <List <T> >().ClearAndFree(list);
 }
예제 #3
0
 public static List <T> Allocate()
 {
     return(SharedPools.Default <List <T> >().AllocateAndClear());
 }
 /// <summary>
 /// Returns the <see cref="string"/> representation of the <paramref name="stringBuilder"/> and frees it back
 /// to the object pool.
 /// </summary>
 /// <param name="stringBuilder">The string builder.</param>
 /// <returns>The <see cref="string"/> representation of the <paramref name="stringBuilder"/>.</returns>
 public static string ReturnAndFree(StringBuilder stringBuilder)
 {
     SharedPools.Default <StringBuilder>().ForgetTrackedObject(stringBuilder);
     return(stringBuilder.ToString());
 }
 /// <summary>
 /// Frees the specified string builder back to the object pool.
 /// </summary>
 /// <param name="stringBuilder">The string builder.</param>
 public static void Free(StringBuilder stringBuilder)
 {
     SharedPools.Default <StringBuilder>().ClearAndFree(stringBuilder);
 }
 /// <summary>
 /// Allocates an instance of <see cref="StringBuilder"/> from the object pool.
 /// </summary>
 /// <returns>An instance of <see cref="StringBuilder"/>.</returns>
 public static StringBuilder Allocate()
 {
     return(SharedPools.Default <StringBuilder>().AllocateAndClear());
 }