2012-10-30 60 views

回答

3
var contacts = from c in xdoc.Descendants("contact") 
       select new Contact() 
       { 
        GUID = (string)c.Element("Guid"), 
        Name = (string)c.Element("Name"), 
        Email = (string)c.Element("Email"), 
        PhoneNumber = (string)c.Element("PhoneNumber") 
       }; 

其中xdocXDocument類的實例。

+0

完美!謝謝。 –