Byte = 8bits, but why doesn't BitConverter think so
Posted
by Paul Farry
on Stack Overflow
See other posts from Stack Overflow
or by Paul Farry
Published on 2010-04-09T02:39:54Z
Indexed on
2010/04/09
2:43 UTC
Read the original article
Hit count: 477
Given the following information
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
Why does bitconverter report that mType is a length of 2. I would have thought that passing a Byte into BitConverter.GetBytes would just return the Byte.
I mean it's no big deal because it's only sending a very small block of data across a TCP Socket, but I'm just intrigued why it thinks it's 2 bytes.
© Stack Overflow or respective owner