1)如果我不使用First(),则需要 8毫秒秒
IEnumerable<string> Discriptionlist = (from lib in ProgramsData.Descendants("program")
where lib.Attribute("TMSId").Value == TMSIds
select lib.Element("descriptions").Element("desc").Value);
2)使用First(),需要 248毫秒秒
string Discriptionlist = (from lib in ProgramsData.Descendants("program")
where lib.Attribute("TMSId").Value == TMSIds
select lib.Element("descriptions").Element("desc").Value).First();
数据读取使用
using (var sr = new StreamReader(FilePath))
{
Xdoc = XDocument.Load(sr);
}
任何解决方案或其他方法来减少时间(少于248ms)并以字符串形式获取结果。谢谢。