Q:

string to byte[] array

ok i know this has been beat to death but i can't seam to get all the ones on google here or anyplace to work 
i have a string that looks like this
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

i store this string
each digit has a range from 0 to 254 and the string is almost random
i need to convert this to a byte array because of a hardware
change
this is what the hardware is looking for 
hardware.command(DeviceID, byte[]);

i tested the  hardware by doing this
hardware.command(1, new byte[] { 0, 0, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38 });

and all was good
each part is a PWM output percentage on the hardware
this updates every 4ms so it has to be somewhat fast

A:

Try something like this: 
string datastring = "1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0";
byte[] data = datastring.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(s => byte.Parse(s)).ToArray();

or, without LINQ:
    var datastring = "1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0";
    var tokens = datastring.Split(',');
    byte[] data = new byte[tokens.Length];
    for (int i = 0; i < tokens.Length; i++) {
        data[i] = byte.Parse(tokens[i]);
    }

