我的XML是:LINQ-to-XML中的InnerText等價於什麼?
<CurrentWeather>
<Location>Berlin</Location>
</CurrentWeather>
我希望字符串 「柏林」,如何獲取內容到元件的位置,像的innerText?
XDocument xdoc = XDocument.Parse(xml);
string location = xdoc.Descendants("Location").ToString();
以上的回報
System.Xml.Linq.XContainer + d__a
我已經試過了,並在單()得到了一個錯誤,原來我有「使用System.Xml.Linq「,但忘了」使用System.Linq「,謝謝。 – 2009-11-03 15:32:42
np,它發生:) – 2009-11-03 15:38:03