Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
因为我喜欢开发文件 I/O 应用程序,而我的新开发平台是 Windows Mobile。有什么方法可以在不使用的情况下读取所有文件File.ReadAllText?
File.ReadAllText
因为Windows Mobile没有这个功能。
自己写:
static string ReadAllText(string path) { using (var r = new StreamReader(path)) { return r.ReadToEnd(); } }
移动框架支持很多文件操作,例如:
string text; using (StreamReader reader = File.OpenText(fileName)) { text = reader.ReadToEnd(); }