Skip to content

Commit 4b1bb26

Browse files
committed
Use span
1 parent 5f3d3ff commit 4b1bb26

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

ValveKeyValue/ValveKeyValue/HexStringHelper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public static byte[] ParseHexStringAsByteArray(string hexadecimalRepresentation)
1212
var data = new byte[hexadecimalRepresentation.Length / 2];
1313
for (var i = 0; i < data.Length; i++)
1414
{
15-
var currentByteText = hexadecimalRepresentation.Substring(i * 2, 2);
16-
data[i] = byte.Parse(currentByteText, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
15+
data[i] = byte.Parse(hexadecimalRepresentation.AsSpan(i * 2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
1716
}
1817

1918
return data;

0 commit comments

Comments
 (0)