考慮以下信息字節= 8位,但爲什麼不BitConverter這麼認爲
Public Enum Request As Byte
None = 0
Identity = 1
License = 2
End Enum
Protected mType As Communication.Request
mType = Communication.Request.Identity
Debug.Print (BitConverter.GetBytes(mType).Length.tostring)
2
爲什麼bitconverter報告說,M型是我本來以爲是2的長度傳遞一個字節到BitConverter.GetBytes只會返回字節。
我的意思是沒什麼大不了的,因爲它只是通過一個TCP套接字發送一個非常小的數據塊,但我只是很好奇它爲什麼認爲它是2個字節。
你真是幸運,一個字節是8的倍數。有時它是6,7或9位。 – WhirlWind 2010-04-09 02:48:29