没有 File.ReadAllText 有什么办法吗?

发布于 2024-08-10 23:13:19 字数 121 浏览 3 评论 0原文

由于我喜欢开发文件 I/O 应用程序,而我的新开发平台是 Windows Mobile。有没有办法在不使用 File.ReadAllText 的情况下读取所有文件?

因为Windows Mobile没有这个功能。

As I love to develop file I/O applications and my new development platform is Windows Mobile. Is there any way to read all the file, without using File.ReadAllText?

Because Windows Mobile doesn't have this function.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜深人未静 2024-08-17 23:13:19

写你自己的:

static string ReadAllText(string path) {
    using (var r = new StreamReader(path)) {
        return r.ReadToEnd();
    }
}

Write your own:

static string ReadAllText(string path) {
    using (var r = new StreamReader(path)) {
        return r.ReadToEnd();
    }
}
如若梦似彩虹 2024-08-17 23:13:19

移动框架支持很多文件操作,例如:

string text;
using (StreamReader reader = File.OpenText(fileName)) {
   text = reader.ReadToEnd();
}

A lot of the file operations are supported by the mobile framework, for example:

string text;
using (StreamReader reader = File.OpenText(fileName)) {
   text = reader.ReadToEnd();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文