从 Silverlight 中的isolatedStorage读取二进制数据
我将一些字节写入了 Silverlight 应用程序中独立存储中的文件中。该文件名为“data.dat”。我使用以下代码将其写入隔离存储:
// Store the data in isolated storage
var bytes = GetData();
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream file = new IsolatedStorageFileStream("data.dat", FileMode.Create, storage))
{
file.Write(bytes, 0, bytes.Length);
}
}
我的问题是,一旦字节存在,如何从隔离存储中检索字节?我看到的所有内容都会返回一个字符串。但我没有看到返回二进制数据的方法。
谢谢。
I have some bytes written to a file in isolated storage in my Silverlight application. This file is named "data.dat". I wrote it to Isolated Storage using the following code:
// Store the data in isolated storage
var bytes = GetData();
using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream file = new IsolatedStorageFileStream("data.dat", FileMode.Create, storage))
{
file.Write(bytes, 0, bytes.Length);
}
}
My question is, how do I retrieve the bytes from isolated storage once they're there? Everything I see returns a string. But I don't see a way to return binary data.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码将检索字节 -
This piece of code will retrieve the bytes -