0
如何我可以選擇ip
和port
元素形成的LINQ此XML文件的XML如何通過LINQ選擇元素,以XML
<?xml version="1.0" encoding="utf-8"?>
<settings>
<IncomingConfig>
<ip>10.100.101.18</ip>
<port>5060</port>
</IncomingConfig>
<Device>
<username>tarek</username>
<AgentName>tarek</AgentName>
<password>ffff</password>
</Device>
<Device>
<username>adf</username>
<AgentName>adf</AgentName>
<password>fadsf</password>
</Device>
</settings>
,我寫這個代碼,但不能正常工作
XDocument doc = XDocument.Load(CONFIGURATION_FULL_PATH);
var port = int.Parse(doc.XPathSelectElement("port").Value);
var localIpAdres = doc.XPathSelectElement("ip").Value;