zl程序教程

您现在的位置是:首页 >  后端

当前栏目

.NET删除字节数组中的0字节

2023-09-11 14:17:56 时间
private static byte[] Decode(byte[] packet)
{
    var i = packet.Length - 1;
    while (packet[i] == 0)
    {
        --i;
    }
    var temp = new byte[i + 1];
    Array.Copy(packet, temp, i + 1);
    return temp;
}