http://www.dreamincode.net/forums/xml.php?showuser=335389
鉴于上面的 XML,我如何遍历“lastvisitors”元素内的每个元素,因为每个子组都是相同的,只是值不同?
//Load latest visitors.
var visitorXML = xml.Element("ipb").Element("profile").Element("latestvisitors");
所以现在我已经捕获了包含我需要的一切的 XElement。有没有办法遍历元素以获得我需要的东西?
我有一个名为 Visitor 的 POCO 对象,其唯一目的是保存必要的信息。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SharpDIC.Entities
{
public class Visitor
{
public string ID { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string Photo { get; set; }
public string Visited { get; set; }
}
}
再次感谢您的帮助。