Skip to content

Commit 794b5a0

Browse files
committed
Use ReadOnlySpan instead of mutable Span in Enumerator
1 parent ba87d1d commit 794b5a0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/LinkDotNet.StringBuilder/ValueStringBuilder.Enumerator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ public ref partial struct ValueStringBuilder
1111
[StructLayout(LayoutKind.Auto)]
1212
public ref struct Enumerator
1313
{
14-
private readonly Span<char> span;
14+
private readonly ReadOnlySpan<char> span;
1515
private int index;
1616

1717
/// <summary>Initializes a new instance of the <see cref="Enumerator"/> struct.</summary>
1818
/// <param name="span">The span to enumerate.</param>
1919
[MethodImpl(MethodImplOptions.AggressiveInlining)]
20-
internal Enumerator(Span<char> span)
20+
internal Enumerator(ReadOnlySpan<char> span)
2121
{
2222
this.span = span;
2323
index = -1;
2424
}
2525

2626
/// <summary>Gets the element at the current position of the enumerator.</summary>
27-
public readonly ref char Current
27+
public readonly char Current
2828
{
2929
[MethodImpl(MethodImplOptions.AggressiveInlining)]
30-
get => ref span[index];
30+
get => span[index];
3131
}
3232

3333
/// <summary>Advances the enumerator to the next element of the span.</summary>

0 commit comments

Comments
 (0)