Class PooledStringBuilder
- Namespace
- WindowSill.API
- Assembly
- WindowSill.API.dll
Provides a utility for managing pooled StringBuilder instances to reduce memory allocations.
public static class PooledStringBuilder
- Inheritance
-
PooledStringBuilder
- Inherited Members
Remarks
The PooledStringBuilder class offers a shared, thread-safe instance of an ObjectPool<T> specifically for StringBuilder objects. This pool uses a default pooling policy that resets the StringBuilder to its initial state when returned to the pool.
Using this class is recommended for scenarios where frequent creation and disposal of StringBuilder instances occur, as it helps improve performance by reusing objects and minimizing garbage collection overhead.
Fields
Instance
Provides a shared, thread-safe instance of an ObjectPool<T> for StringBuilder objects.
public static readonly ObjectPool<StringBuilder> Instance
Field Value
Remarks
This instance uses a default pooling policy for StringBuilder objects, which resets the StringBuilder to its initial state when returned to the pool. It is recommended to use this instance for efficient reuse of StringBuilder objects to reduce memory allocations.