Skip to content

Commit

Permalink
optimise Alloc implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
xtqqczze committed Dec 12, 2024
1 parent 3401370 commit 8cc1fe8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libraries/System.Private.CoreLib/src/System/String.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ public static bool IsNullOrWhiteSpace([NotNullWhen(false)] string? value)
internal static string Alloc(int length, out Span<char> resultSpan)
{
string result = FastAllocateString(length);
resultSpan = new Span<char>(ref result._firstChar, result._stringLength);
Debug.Assert(result.Length == length);
resultSpan = new Span<char>(ref result._firstChar, length);
return result;
}

Expand Down

1 comment on commit 8cc1fe8

@xtqqczze
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.