How do you convert 3 bytes into a 24 bit number in C#? -
I have an array of bytes, which I read from the header section of the message. These bytes contain the length of the message. Never exceed 3 bytes and they are ordered from LSB to MSB. So in the example below, there are 39 LSBs and 2 MSBs.
var data = new byte [] {39, 213, 2};
In the above example, how can I take those bytes and convert to a number (int, short, etc.)?
var num = data [0] + (data [1]
Comments
Post a Comment