Max,
If you want a general way to convert the binary representation of a
number to a byte, then use the static ToByte method on the Convert class,
like so:
// Convert "10" to a byte:
byte b = Convert.ToByte("10", 2);
The second parameter is the base to interpret the string in.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Max Adams" <ru************@hotmail.com> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
How can I set a byte to hold the binary value 10?
Doing this doesn't work, I want to store the code for 10 in 1 byte of
memory.
byte encodedBytes = '10';
Doesn't compile "Too many characters in character literal"
Any thoughts?