Class PooledStringBuilder
Represents a mutable string of characters. This class cannot be inherited. Instances of this type are kept in a pool for recycling.
Inheritance
Namespace: System.Text
Assembly: Nuqleon.Memory.dll
Syntax
public class PooledStringBuilder : Object, IFreeable, IClearable
Fields
StringBuilder
Gets the StringBuilder instance held by this pooled string builder instance.
Declaration
public readonly StringBuilder StringBuilder
Field Value
Type | Description |
---|---|
System.Text.StringBuilder |
Methods
Clear()
Clears the object.
Declaration
public void Clear()
Free()
Frees the object and returns it to the pool.
Declaration
public void Free()
GetInstance()
Gets a StringBuilder instance from the global pool.
Declaration
public static PooledStringBuilder GetInstance()
Returns
Type | Description |
---|---|
PooledStringBuilder | A StringBuilder instance obtained from the global pool. |
New()
Gets a pooled StringBuilder instance, from the global pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledStringBuilderHolder New()
Returns
Type | Description |
---|---|
PooledStringBuilderHolder | Pooled string builder instance. |
New(StringBuilderPool)
Gets a pooled StringBuilder instance, from the specified pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledStringBuilderHolder New(StringBuilderPool pool)
Parameters
Type | Name | Description |
---|---|---|
StringBuilderPool | pool | Pool to allocate from. |
Returns
Type | Description |
---|---|
PooledStringBuilderHolder | Pooled string builder instance. |
Exceptions
Type | Condition |
---|---|
System.NullReferenceException | Thrown if |
ToString()
Gets the string built by the string builder.
Declaration
public string ToString()
Returns
Type | Description |
---|---|
System.String | String built by the string builder. |
ToStringAndFree()
Gets the string built by the string builder and returns the builder back to the pool.
Declaration
public string ToStringAndFree()
Returns
Type | Description |
---|---|
System.String | String built by the string builder. |
ToStringBuilder()
Obtains the underlying StringBuilder instance.
Declaration
public StringBuilder ToStringBuilder()
Returns
Type | Description |
---|---|
System.Text.StringBuilder | The underlying StringBuilder instance. |
Operators
Implicit(PooledStringBuilder to StringBuilder)
Converts a pooled string builder to its underlying StringBuilder instance.
Declaration
public static implicit operator StringBuilder(PooledStringBuilder obj)
Parameters
Type | Name | Description |
---|---|---|
PooledStringBuilder | obj | Pooled string builder to convert. |
Returns
Type | Description |
---|---|
System.Text.StringBuilder | The underlying StringBuilder instance. |