1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 22:55:42 +00:00

Replace stackalloc and ToArray combination to array initialization directly

This commit is contained in:
RealityProgrammer 2023-03-06 07:17:32 +07:00
parent 862d3ad189
commit 4300e35b4e

View File

@ -16,9 +16,9 @@ public static class Int32Extensions
[Pure]
public static byte[] GetBytes(this int value)
{
Span<byte> buffer = stackalloc byte[4];
byte[] buffer = new byte[4];
value.TryWriteBytes(buffer);
return buffer.ToArray();
return buffer;
}
/// <summary>