2010-06-28 64 views

回答

0

我不認爲你可以將它轉換爲XML,我會將二進制文件轉換爲基本64字符串。

Stream fileStream = file.OpenRead(); 
    stream.Seek(0, SeekOrigin.Begin); 
    byte[] binaryData = new Byte[stream.Length]; 
    long bytesRead = stream.Read(binaryData, 0, (int)stream.Length); 

    string base64String = 
      System.Convert.ToBase64String(binaryData, 
              0, 
              binaryData.Length); 

    return base64String;