Jonathan. Jonathan. - 1 year ago 47 Question

Getting four bytes from a byte array in VB.NET

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


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);