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:
parent
862d3ad189
commit
4300e35b4e
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user