I received the contents of a text file returned in binary values:
Byte[] buf = new Byte[size];
stream = File.InputStream;
stream.Read(buf, 0, size);
You can use:
System.Text.Encoding.ASCII.GetString(buf);
But sometimes you will get a weird number instead of the string you want. In that case, your original string may have some hexadecimal character when you see it. If it's the case, you may want to try this:
System.Text.Encoding.UTF8.GetString(buf);
Or as a last resort:
System.Text.Encoding.Default.GetString(bytearray);