從檔案中讀取位元組陣列 byte[] Bytes = File.ReadAllBytes(FileName);
從中讀取兩個位元組并且轉換為short型別的X short X = (short)BitConverter.ToInt16(Bytes, 0)
上面的方法通過查閱相關資料 相當于 short X = Bytes[0]+ (Bytes[1] << 8)
我想知道short X = Bytes[0]+ (Bytes[1] << 8) 具體的原理是什么樣的
假設有兩個byte型別的數188(二進制10111100),2(二進制00000010) 正確的結果為700
根據左移運算子的規則,我無法得出正確的結果
請教計算機具體的計算程序(二進制)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/230849.html
標籤:C#
