0
我搜查,发现这一点,但它并不适用于Windows Phone 8的,只适用于Windows Store应用程序:如何字节数组写入StorageFile中的WindowsPhone 8
http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.fileio.writebytesasync
如何在WP8做到这一点?
我搜查,发现这一点,但它并不适用于Windows Phone 8的,只适用于Windows Store应用程序:如何字节数组写入StorageFile中的WindowsPhone 8
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);
}
为什么使用的BinaryWriter? 'fs.Write(buffer,0,buffer.Length);' –
@KooKiz - 当然你是对的,它会更简单。 – Romasz
什么是ISF? –