Try the following:
Byte[] bytes = System.Text.Encoding.UTF8.GetBytes(yourString);
You may need to change this depending on the character encoding of your string - see System.Text.Encoding (in particular, its properties) for other encodings supported by this type.
If you need to go the other way (and convert Byte[] to String ) then do it (the character encoding tip still applies here):
String yourString = System.Text.Encoding.UTF8.GetString(yourByteArray);
It looks like your API you are using expects String[] , and calling GetString will provide you with only one instance of String , not an array. Perhaps something like this will work for your API call:
String yourString = System.Text.Encoding.UTF8.GetString(yourByteArray); someType.ApiCall(new[] { yourString });
Andrew Hare
source share