How can I store an int32 at a specific location in a byte array?
As far as I can tell, I need to use BitConverter.GetBytes(value); to get the byte[4].
Then I have a byte[whatever_size] and offset.
public void SetInt32(byte[] message, int offset, Int32 value)
{
var value_bytes = BitConverter.GetBytes(value);
message[offset] = value_bytes;
}
You can get the bytes directly by using bitwise arithmetic: