Skip to content

Commit 8fe75ac

Browse files
authored
Merge pull request #227 from Joy-less/add-IDisposable
Add IDisposable to ValueStringBuilder
2 parents fb9505c + 7d17255 commit 8fe75ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/LinkDotNet.StringBuilder/ValueStringBuilder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
namespace LinkDotNet.StringBuilder;
66

77
/// <summary>
8-
/// Represents a string builder which tried to reduce as much allocations as possible.
8+
/// A string builder which minimizes as many heap allocations as possible.
99
/// </summary>
1010
/// <remarks>
11-
/// The <see cref="ValueStringBuilder"/> is declared as ref struct which brings certain limitations with it.
12-
/// You can only use it in another ref struct or as a local variable.
11+
/// This is a ref struct which has certain limitations. You can only store it in a local variable or another ref struct.<br/><br/>
12+
/// You should dispose it after use to ensure the rented buffer is returned to the array pool.
1313
/// </remarks>
1414
[StructLayout(LayoutKind.Sequential)]
1515
[SkipLocalsInit]
16-
public ref partial struct ValueStringBuilder
16+
public ref partial struct ValueStringBuilder : IDisposable
1717
{
1818
private int bufferPosition;
1919
private Span<char> buffer;
@@ -294,7 +294,7 @@ public readonly int LastIndexOf(ReadOnlySpan<char> word, int startIndex)
294294
public readonly bool Equals(ReadOnlySpan<char> span) => span.SequenceEqual(AsSpan());
295295

296296
/// <summary>
297-
/// Disposes the instance and returns rented buffer from an array pool if needed.
297+
/// Disposes the instance and returns the rented buffer to the array pool if needed.
298298
/// </summary>
299299
[MethodImpl(MethodImplOptions.AggressiveInlining)]
300300
public void Dispose()

0 commit comments

Comments
 (0)