我遇到了使用StreamReader类的障碍。在StreamReader Class文档页面上,它指出 支持版本信息标题“Universal Windows Platform - Available since 8”下的通用Windows平台(UWP)。将StreamReader(字符串)转换为与UWP API兼容?
进一步检查其构造函数后,StreamReader(Stream)构造函数确实支持UWP应用程序,但StreamReader(String)构造函数不支持它们。
目前我使用的是完整的文件路径的StreamReader(String)构造要被读取,
using (StreamReader sr = new StreamReader(path))
{
...
}
我正在寻找了解如何我的代码转换为一个StreamReader(字符串)一个StreamReader(流)。
是[this](https://stackoverflow.com/questions/1879395/how-to-generate-a-stream-from-a-string)你想完成什么? – Kilazur
你是字符串文件名还是字符串。要读取字符串,请使用StringReader(string)。 StreamReader中的字符串是一个文件名。 – jdweng
@Kilazur,在某种意义上是的。我想使用路径。 – jtth