mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-23 01:58:49 +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]
|
[Pure]
|
||||||
public static byte[] GetBytes(this int value)
|
public static byte[] GetBytes(this int value)
|
||||||
{
|
{
|
||||||
Span<byte> buffer = stackalloc byte[4];
|
byte[] buffer = new byte[4];
|
||||||
value.TryWriteBytes(buffer);
|
value.TryWriteBytes(buffer);
|
||||||
return buffer.ToArray();
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user