using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;
class Program
{
static void Main(string[] args)
{
string xmlFileName = "e.xml";
XDocument customers = XDocument.Load(xmlFileName);
var queryResults =
from c in customers.Descendants("order").Attributes("orderYear")
select c.Value;
Console.WriteLine("Earliest year in which orders were placed: {0}", queryResults.Min());
}
}
|