StreamReader(string) 在 .NET 4.5 for Metro 中应该存在时不存在吗? [英] StreamReader(string) does not exist in .NET 4.5 for Metro when it is supposed to?

查看:29
本文介绍了StreamReader(string) 在 .NET 4.5 for Metro 中应该存在时不存在吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据:http://msdn.microsoft.com/en-us/library/windows/apps/system.io.streamreader.aspx

并且:http://msdn.microsoft.com/en-us/library/windows/apps/f2ke0fzy.aspx

证明这是用于 Metro 参考的 .NET:http://msdn.microsoft.com/en-us/library/windows/apps/br230232.aspx

Proof that this is the .NET for Metro Reference: http://msdn.microsoft.com/en-us/library/windows/apps/br230232.aspx

有一个用于指定文件路径的构造函数.然而在 Object Broswer &在元数据中它不存在.

There is a constructor for specifying a file path. Yet in Object Broswer & in the meta data it does not exist.

显然所有 .NET for Metro 的东西都在参考"选项卡中引用.

And apparently all .NET for Metro things are referenced in the References Tab.

我只是想从项目文件夹中访问一个 txt 文件,仅此而已.如果有人有替代方案,我会全力以赴.

I am simply trying to access a txt file from the Project Folder, nothing more. If anyone has an alternative I am all ears.

推荐答案

这是 WinRT 的根本变化之一.你不能再在任何你想写的地方写一个文件,你必须使用隔离存储.而且你需要使用带有 await 关键字的异步 I/O."

"This is one of the fundamental changes in WinRT. You can't just write a file anywhere you want anymore, you have to use isolated storage. And you need to use asynchronous I/O with the await keyword."

此链接应为您提供有关如何访问项目文件夹中文件的必要信息.这是链接:

This link should provide you with the necessary information on how to access files in your project folder. Here is the link:

http:///blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html

这篇关于StreamReader(string) 在 .NET 4.5 for Metro 中应该存在时不存在吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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