我有一个任意长度的 byte[] 数组,我想将它分成多个部分,每个部分的长度为 2205,我必须对这 2205 个字节进行操作,这是我的算法:
// SPLIT BY 2205 Bytes
int block = 2205;
int counter = 0;
byte[] to_Send = new byte[block];
foreach (byte b in ARCHIEVE_BUFFER)
{
if (counter < 2205)
{
to_Send[counter] = b;
counter++;
}
else if (counter == 2205)
{
// do some operation on those 2205 bytes which stored on the array to_send
counter = 0;
to_Send[counter] = b;
counter++;
}
}
我只想将数组拆分为固定数量的范围