A Built-in Function to Convert from String to Byte
- by Ngu Soon Hui
I have the following function:
public static byte[] StringToByte(string str)
{
int length = str.Length;
byte[] ba = new byte[length];
for (int i = 0; i < length; i++)
{
ba[i] = (byte)str[i];
}
return ba;
}
I wonder whether there is a built-in function for this method?