Wednesday, 15 May 2013

Copy Bytes from a byte array to a specific position of another Byte array in C# -



Copy Bytes from a byte array to a specific position of another Byte array in C# -

i have 2 byte arrays - array1 , array2 . aim re-create bytes 1st array sec respect start index of each array , fill non filled bytes specific byte.

byte[] array1 = new byte[5] info follows: 11,22,00,33,44; byte[] array2 = new byte[10];

i need re-create bytes array1 array2. info needs copied position 3 in array2 , fill rest of empty positions value ff. ie result in array2 {ff,ff,ff,11,22,00,33,44,ff,ff}

any help appreciable.

thanks in advance!

// init array2 0xff (int = 0; < array2.length; i++) array2[i] = 0xff; // re-create array.copy(array1, 0, array2, 3, array2.length);

c# arrays bytearray

No comments:

Post a Comment