Writing to files in bytes.

If I have a string that looks like your standard byte, for example: “01001100”, can I write this to a file and have it use just one byte? As opposed to the 8 it would normally take up if I use the normal StreamWriter method or something similar.

something like this might work:

byte value = 0;
    int index = 0;
    char[] cs = byteString.toCharArray();
    for (int i = 0;i<cs.Length(),i++) {
        if (cs*=='1') {*
 *value += (1<< (8-i));*
 *// now save that byte.*