2

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.

2

1 Answer 1

4

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);
Sign up to request clarification or add additional context in comments.

1 Comment

@PeterMortensen, if English isn't your first language, do try to avoid editing answers, at least the non-code portions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.