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

时间:2023-03-09 18:29:09
.NET删除字节数组中的0字节
private static byte[] Decode(byte[] packet)
{
var i = packet.Length - ;
while (packet[i] == 0)
{
--i;
}
var temp = new byte[i + ];
Array.Copy(packet, temp, i + );
return temp;
}

相关文章