I am triyng to convert byte array into an int value however I am getting an exception:
"Destination array is not long enough to copy all the items in the collection. Check array index and length."
the exception is on line:
int length = BitConverter.ToInt32(bytes_length, 0);
byte _length contain the value (0x00,0x09);
here is my code:
byte[] bytes_length = new byte[Value_of_length];
//copy the byte byte array to the correct length.
Array.Copy(data, Place_of_length, bytes_length, 0,bytes_length.Length
int length = BitConverter.ToInt32(bytes_length, 0);