我搜索并找到了这个,但它不适用于 Windows Phone 8,并且仅适用于 Windows Store 应用程序:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.writebytesasync
我如何在 WP8 中做到这一点?
我搜索并找到了这个,但它不适用于 Windows Phone 8,并且仅适用于 Windows Store 应用程序:
http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.writebytesasync
我如何在 WP8 中做到这一点?
您可以使用二进制编写器:
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);
}