我确实有一个类似这样的 XML
<?xml version="1.0" encoding="UTF-8"?>
<e_schema>
<schema_name value="shema1">
<contact>
<id>1</id>
<firstName>firstname1</firstName>
<lastName>lastname1</lastName>
<department>IT</department>
<emailAddress>lastname1@mydomain.com</emailAddress>
<lineManagerId>22331470</lineManagerId>
<telephone_number>
<number1>0000000000</number1>
<number2>1111111111</number2>
<number3>2222222222</number3>
<retries1>2</retries1>
<retries2>1</retries2>
<retries3>2</retries3>
<numberType1>Mobile</numberType1>
<numberType2>Fixnet</numberType2>
<numberType3>Fixnet</numberType3>
</telephone_number>
</contact>
<contact>
<id>2</id>
<firstName>firstname2</firstName>
<lastName>lastname2</lastName>
<department>SUPPORT</department>
<emailAddress>lastname2@mydomain.com</emailAddress>
<lineManagerId>22331470</lineManagerId>
<telephone_number>
<number1>3333333333</number1>
<number2>4444444444</number2>
<number3>5555555555</number3>
<retries1>2</retries1>
<retries2>1</retries2>
<retries3>2</retries3>
<numberType1>Mobile</numberType1>
<numberType2>Fixnet</numberType2>
<numberType3>Fixnet</numberType3>
</telephone_number>
</contact>
</schema_name>
</e_schema>
现在使用这段代码,我读取了每个联系人节点并将它们添加到列表中
var xmlcontacts = xmlloaded.Descendants("schema_name").Where(node => (string)node.Attribute("value") == comboSchema.SelectedValue.ToString());
foreach (XElement subelement in xmlcontacts.Descendants("contact")) //element is variable
{
contact.Add(new Contact()
{
id = subelement.Element("id").Value,
firstName = subelement.Element("firstName").Value,
lastName = subelement.Element("lastName").Value,
department = subelement.Element("department").Value,
emailAddress = subelement.Element("emailAddress").Value,
lineManagerId = subelement.Element("lineManagerId").Value,
//_phonenumbers = phones
});
}
但我不知道如何使用电话号码读取节点,有人可以给出提示或一行代码我该怎么做!