我正在使用Visual Studio 2012,C#,Silverlight,Windows Phone 8应用程序。写入字节数组到存储文件在Windows Phone中
我们从web服务获取数据,并通过web服务获得一个base64字符串的图片。
我将它转换为一个字节数组,现在我想保存它,以便存储的Windows手机,使用内存流?我不知道这是否正确。我不想将它保存到独立的存储中,只是本地文件夹,因为我想在用户点击链接后显示图片。
这是我到目前为止。
byte[] ImageArray;
var image = Attachmentlist.Attachment.ToString();
imagename = Attachmentlist.FileName.ToString();
ImageArray = Convert.FromBase64String(image.ToString());
StorageFolder myfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
await myfolder.CreateFileAsync(imagename.ToString());
StorageFile myfile = await myfolder.GetFileAsync(imagename.ToString());
MemoryStream ms = new MemoryStream();
所以后,我已经初始化内存流我怎么把字节数组,并将其写入到存储文件,之后再找回?
感谢您的快速响应,纠正我,如果我错了,但不是FileIO的Visual Basic命名空间?如果是的话,FileIO的视觉工作室版本是什么 - google到目前为止还没有多大帮助 – Arrie
@Arrie检查了这一点:[doucmentation](http://msdn.microsoft.com/en-us/library/windows/apps/windows .storage.fileio.writebytesasync),它的Windows 8特定类。 – Rafal
太棒了!它工作正常! :) – Arrie