110,499
社区成员
发帖
与我相关
我的任务
分享
class IntValue
{
public int Value { get; set; }
}
class Program
{
static void Main(string[] args)
{
string xml = "<root><value>1</value><value>2</value></root>";
XDocument doc = XDocument.Parse(xml);
List<IntValue> valueList = (from elem in doc.Root.Elements("value")
select new IntValue
{
Value = int.Parse(elem.Value)
}).ToList();
}
}