Possible Duplicate:
byte[] to string in c#
I have an byte array read from a stream. I’d like to convert it to a string.
This worked for me:
var str= new string(bytearr.Select(x=>(char)x).ToArray());
But I feel there’s a better way to do it? Is there?
You will need to know the correct encoding and use that, UTF8 is just an example. Based on what worked for you, I will guess that you either have UTF8 or ASCII.