<Fields>
<Field>
<Company>My Company</Company>
</Field>
<Field>
<Address2>Villa at beach</Address2>
</Field>
<Field>
<Email2>[email protected]</Email2>
</Field>
<Field>
<Mobile>333-888</Mobile>
</Field>
<Field>
<ContactMethod>Facebook</ContactMethod>
</Field>
</Fields>
How to get element's name using LINQ?
var fields = (from field in contact.XmlFields.Descendants("Field")
select new ContactXmlView
{
Field = ...,
Value = ...
});
So that I can have such output:
Company: My Company
Address2: Villa at beach...
Thanks in advance,
Ile