views:

255

answers:

1

I have a byte array and I need to get 4 bytes from it at a certain location(16) but I don't want to convert it to a integer or anything just keep it as 4 bytes to store in a variable.

(I am sorry if this is too similar to my last question)

+2  A: 

If you have say:

byte[] source; // source array
byte[] dest=new byte[4];

Then you'd copy 4 bytes from source starting at 16 to dest like this:

Array.Copy(source, 16, dest, 0, 4);
Blindy