var _bytes= new byte[]{0, 12, 0, 6, 19, 136}; var _size = 3; //byte with 3 item is decimal var _num = 2 ; //length of block define in array byte var _result = ""; for (int i = 0; i < _size; i++) { //get value decimal in byte array follow the block define //var _id = BitConverter.ToInt16(_bytes[i] * 2, 2); _result += _id + " "; } //the _result should be "12 6 5000" //0 12 is decimal 12 //0 6 is decimal 6 //19 136 is decimal 5000
var _id = Convert.ToDecimal(Convert.ToInt32(BitConverter.ToInt16((_bytes[i] * 2, 2).Reverse().ToArray(), 0).ToString("X4"), 16));
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)