Class StringBuilderPool
Object pool for System.Text.StringBuilder instances.
Implements
Inherited Members
Namespace: System.Text
Assembly: Nuqleon.Memory.dll
Syntax
public abstract class StringBuilderPool : ObjectPoolBase<PooledStringBuilder>, IObjectPool<PooledStringBuilder>, IObjectPoolAllocateFree<PooledStringBuilder>, IObjectPoolNew<PooledStringBuilder>
Constructors
StringBuilderPool(Int32)
Creates a new System.Text.StringBuilder pool of the specified pool size.
Declaration
protected StringBuilderPool(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Text.StringBuilder instances to keep in the pool. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
Methods
Create(Int32)
Creates a new System.Text.StringBuilder pool of the specified pool size. The pool creates new instances of System.Text.StringBuilder by calling the default constructor on StringBuilder.
Declaration
public static StringBuilderPool Create(int size)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Text.StringBuilder instances to keep in the pool. |
Returns
Type | Description |
---|---|
StringBuilderPool | Newly created pool for System.Text.StringBuilder instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
Create(Int32, Int32)
Creates a new System.Text.StringBuilder pool of the specified pool size.
The pool creates new instances of System.Text.StringBuilder by calling the constructor on System.Text.StringBuilder, passing in the specified capacity
.
Declaration
public static StringBuilderPool Create(int size, int capacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Text.StringBuilder instances to keep in the pool. |
System.Int32 | capacity | The suggested starting size of this instance. |
Returns
Type | Description |
---|---|
StringBuilderPool | Newly created pool for System.Text.StringBuilder instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
Create(Int32, Int32, Int32)
Creates a new System.Text.StringBuilder pool of the specified pool size.
The pool creates new instances of System.Text.StringBuilder by calling the constructor on System.Text.StringBuilder, passing in the specified capacity
.
Declaration
public static StringBuilderPool Create(int size, int capacity, int maxCapacity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | size | Number of System.Text.StringBuilder instances to keep in the pool. |
System.Int32 | capacity | The suggested starting size of this instance. |
System.Int32 | maxCapacity | The maximum capacity allowed for pooled instances. |
Returns
Type | Description |
---|---|
StringBuilderPool | Newly created pool for System.Text.StringBuilder instances. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if |
New()
Gets a holder to a pooled string builder instance with RAII capabilities to return it to the pool.
Declaration
public PooledStringBuilderHolder New()
Returns
Type | Description |
---|---|
PooledStringBuilderHolder | Holder to a pooled string builder instance. |