0

我搜索并找到了这个,但它不适用于 Windows Phone 8,并且仅适用于 Windows Store 应用程序:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.writebytesasync

我如何在 WP8 中做到这一点?

4

1 回答 1

0

您可以使用二进制编写器:

byte[] buffer;   

using (IsolatedStorageFile ISF = IsolatedStorageFile.GetUserStoreForApplication())
{

  using (IsolatedStorageFileStream FS = new IsolatedStorageFileStream(fileName, FileMode.Create, ISF))
  {
    using (BinaryWriter BW = new BinaryWriter(FS))
    {
      BW.Write(buffer, 0, buffer.Lenght);
    }
  }
}

或者像@KooKiz 所说的那样让它更简单:

using (IsolatedStorageFileStream FS = new IsolatedStorageFileStream(fileName, FileMode.Create, ISF))
 {
     FS.Write(buffer, 0, buffer.Lenght);    
 }
于 2013-10-30T14:55:57.043 回答