Trying to figure out the byte[] equivalent of this
string getText = string.Empty;
using (StreamReader sr = new StreamReader((System.IO.Stream)File.OpenRead(unc), true))
{
getText = sr.ReadToEnd();
}
Would like to convert a byte[] to string with specified byte order mark detection option like is available with StreamReader.
You can still use
StreamReader– just wrap the byte array in aMemoryStream. (It’s not clear why you’re castingFile.OpenReadtoStream, by the way…)