Click to See Complete Forum and Search --> : Binary array to string


pjpark
May 28th, 2002, 08:19 AM
What is the best (fastest) way to convert a string stored in a binary array to a string object?

pjpark
May 28th, 2002, 03:24 PM
At long last after hours of research I have found the stupid answer.

To convert a byte array to string use and vice-versa ;) :

dim enc As New System.Text.ASCIIEncoding
dim bytes() As Byte
dim strMessage as String

strMessage = "Hello World"

bytes = enc.GetBytes(strMessage)
strMessage = enc.GetString(bytes)


Why is .NET stuff like this so stupidly easy but such a pain in the axe to find documented? :confused::mad:

Rats,

pjp