I want to convert string to binary and I tried this code
byte[] arr = System.Text.Encoding.ASCII.GetBytes(aa[i]);
and this
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] arr= encoding.GetBytes(aa[i]);
but it returned numbers not binary say If I write 'm' it convert it to "0109" and I want to convert to zeros & Ones only Thanks in advance
Here is an example:
You could use : Convert.ToByte(string value, int fromBase)
According to MSDN :
For more detail, see this link : Convert.ToByte()
I'm not sure I completely understand your question, but if you want to convert text to binary this is how it is done:
You need to pass the whole string, not the characters in the string.
Something like this ought to do you;
So you can get to bytes, now you want to output 0s and 1s.
For a single
byte b