我遇到了使用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