首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在StorageFile 8中向StorageFile写入字节数组

如何在StorageFile 8中向StorageFile写入字节数组
EN

Stack Overflow用户
提问于 2013-10-30 14:31:52
回答 1查看 1.6K关注 0票数 0

我搜索并找到了这个,但是Windows 8无法使用它,只适用于Windows应用程序:

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

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-10-30 14:55:57

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

代码语言:javascript
复制
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说的:

代码语言:javascript
复制
using (IsolatedStorageFileStream FS = new IsolatedStorageFileStream(fileName, FileMode.Create, ISF))
 {
     FS.Write(buffer, 0, buffer.Lenght);    
 }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19685114

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档