This code sample shows how to convert a string to a byte array. //function to convert string to byte array
//function to convert string to byte array
public static byte[] ConvertStringToByteArray(string stringToConvert)
{
return (new UnicodeEncoding()).GetBytes(stringToConvert);
}