Tuesday, March 18, 2008

How to convert string to byte[]

Here is a litle function to convert string to byte array.


public static byte[] StringToByteArray(string inputString)
{
System.Text.ASCIIEncoding encoding=new System.Text.ASCIIEncoding();
return encoding.GetBytes(inputString);
}

No comments: