I have a byte array. I need to copy alternate elements 0,2nd,4th ,6th ,8th elements ......and so on from the source byte array to new destination array.
How do I do that in C#?
How do I do that in C#?
abyteArray0 = abyteArray[0]; //source
byte[] NewArray = null; //dest
for (int i = 0; i < abyteArray0.Length ; i++)
{
if ((i % 2 == 0))
{
//NewArray[i] = abyteArray0[i];
Array.Copy(abyteArray0, i, NewArray, i, 1);
}
i = i + 1;
}
Comment