A Built-in Function to Convert from String to Byte
Posted
by Ngu Soon Hui
on Stack Overflow
See other posts from Stack Overflow
or by Ngu Soon Hui
Published on 2010-03-18T08:33:09Z
Indexed on
2010/03/18
8:41 UTC
Read the original article
Hit count: 220
c#
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?
© Stack Overflow or respective owner