From string to byte array

So you want to transform your nice string in a byte array.

Here you go.

public byte[] stringToByteArray(String bytes)
{
    int size = bytes.Length;
    byte[] returnValue = new byte[size];
    for (int i = 0; i < size; i++)
    {
        returnValue[i] = (byte)Char.GetNumericValue(bytes[i]);
    }

    return returnValue;
}

Now you can fly.