假设byte[] data中存有一个文件的二进制数据,如何让其显示出文本格式的字符来??

解决方案 »

  1.   

    UTF8Encoding encoding = new UTF8Encoding();     
    string sTemplate = encoding.GetString(buffur);
    Buffue是Byte[]
      

  2.   

    FileStream fs = new FileStream(@"c:\txt.txt",FileMode.Open);
    byte[] bytes = new byte[fs.Length];
    fs.Read(bytes,0,bytes.Length);fs.Close();文件转成二进制UnicodeEncoding ue = new UnicodeEncoding();
    string strText = ue.GetString(bytes);