不能,得先转换成TextReader
再用XDocument.Load方法读取
需要将字节流转换成字符流
using (StreamReader sr = new StreamReader("TestFile.txt"))
{
string line;
// Read and display lines from the file until the end of
// the file is reached.
while ((line = sr.ReadLine()) != null)
{
Console.WriteLine(line);
}
}