converting from byte[] to string [duplicate]
Possible Duplicate:
Converting from byte[] to string
How to convert from byte[] to string when we are importing a excel .?
string myString =System.Text.Encoding.UTF8.GetString(myByteArray);
Encoding.Default.GetString(yourbytearray)
byte[] b = new byte[100];
string ascii_string = System.Text.ASCIIEncoding.ASCII.GetString(b); // For ascii string
string uni_string = System.Text.Encoding.UTF8.GetString(b); // For Unicode String
That's be the Encoding namespaces.
For example this method takes a byte array and returns a string
return System.Text.Encoding.UTF8.GetString(byteArray);
精彩评论