如何合并数组最高效内存占用最小
蔡袅 2013-07-20 03:47:16 //上次剩余长度
int iLastLeft = m_datagramBuffer.Length;
//合并之后的大小
int iCombineLen = iLastLeft + readBytesLength;
//合并缓存
byte[] bTmpAlls = new byte[iCombineLen];
//m_AllBuffer 与当前可读数据合并
Buffer.BlockCopy(m_datagramBuffer, 0, bTmpAlls, 0, iLastLeft);
Buffer.BlockCopy(m_receiveBuffer, 0, bTmpAlls, iLastLeft, readBytesLength);
目的得到m_datagramBuffer和m_receiveBuffer的合并数组,数组有时候比较大
这样写的,还是会出现OutOfMemoryException异常