Skip to content

Commit a9dcf99

Browse files
authored
Remove range check in VSB.Append(char) (#82264)
1 parent d32b27a commit a9dcf99

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libraries/Common/src/System/Text/ValueStringBuilder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ public void Insert(int index, string? s)
170170
public void Append(char c)
171171
{
172172
int pos = _pos;
173-
if ((uint)pos < (uint)_chars.Length)
173+
Span<char> chars = _chars;
174+
if ((uint)pos < (uint)chars.Length)
174175
{
175-
_chars[pos] = c;
176+
chars[pos] = c;
176177
_pos = pos + 1;
177178
}
178179
else

0 commit comments

Comments
 (0)