Friday, February 11, 2011

getting 4 bytes from a byte array vb.net

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)

  • 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);
    
    From Blindy

0 comments:

Post a Comment