V1.2 新构架

This commit is contained in:
Aigio Liu
2021-02-20 16:45:44 +08:00
parent c2d95a1833
commit 4d76decf73
343 changed files with 41333 additions and 4 deletions
@@ -0,0 +1,26 @@
using System.Runtime.InteropServices;
// ReSharper disable once CheckNamespace
namespace System
{
public static class ByteArrayExtensions
{
public static sbyte[] ToSByteArray(this byte[] buffer)
{
ReadOnlySpan<byte> _buffer = buffer;
return _buffer.ToSByteArray();
}
public static sbyte[] ToSByteArray(this ReadOnlySpan<byte> buffer)
=> MemoryMarshal.Cast<byte, sbyte>(buffer).ToArray();
public static byte[] ToByteArray(this sbyte[] buffer)
{
ReadOnlySpan<sbyte> _buffer = buffer;
return _buffer.ToByteArray();
}
public static byte[] ToByteArray(this ReadOnlySpan<sbyte> buffer)
=> MemoryMarshal.Cast<sbyte, byte>(buffer).ToArray();
}
}