I have a string that contains the following 7 bits: 1101000. How can I convert it to a byte or int?
2 Answers
to convert into byte array:
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();
byte [] dBytes = encoding.GetBytes(str);
1 Comment
Jon Skeet
Well that will convert it into a byte array, but almost certainly not in the way that the OP wants. (There's no need to create a new instance of
ASCIIEncoding, btw - just use Encoding.ASCII.)