我正在使用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