如何将字节 [] 读/写到隔离存储中 [英] How to read/write byte[] into Isolated storage

查看:24
本文介绍了如何将字节 [] 读/写到隔离存储中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我如何在 WP7 中将字节数组读写到独立存储文件中?

Can anyone tell me how to read and write byte array into Isolated Storage file in WP7?

推荐答案

IsolatedStorageFileSystem 有一个写字节数组的方法:

IsolatedStorageFileSystem has a method for writing byte arrays:

public override void Write(byte[] buffer, int offset, int count);

可以如下使用:

  byte[] myByteArray = ...
  using (var store = IsolatedStorageFile.GetUserStoreForApplication())
  using (var stream = new IsolatedStorageFileStream("filename.txt",
                 FileMode.Create, FileAccess.Write, store))
  {
      stream.Write(myByteArray, 0, myByteArray.Length);
  }

这篇关于如何将字节 [] 读/写到隔离存储中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆