Prefer AsSpan to Substring to avoid unnecessary allocation

(cherry picked from commit 4db10e6283fa5c5c167604a6cdade7299d567f4d)

Close #2263
This commit is contained in:
Qstick 2023-01-09 22:20:25 -06:00 committed by Bogdan
parent 6827ac5670
commit 55308bef8b

View file

@ -250,7 +250,7 @@ protected string ReadEscapedString(char escape)
}
Index = end + 1;
identifier.Append(Buffer.Substring(start, end - start));
identifier.Append(Buffer.AsSpan(start, end - start));
if (Buffer[Index] != escape)
{