I have string which is storing only 1’s and 0’s .. now i need to convert it to a byte array. I tried ..
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
byte[] d = encoding.GetBytes(str5[1]);
but its giving me byte array of ASCIIs like 48’s and 49’s but i want 1’s and 0’s in my byte array.. can any one help
That is the correct result from an encoding. An encoding produces bytes, not bits. If you want bits, then use bit-wise operators to inspect each byte. i.e.