You are creating a Windows Forms application by using the .NET Framework 3.5.
You use LINQ expressions to read a list of customers from the following XML file.
<customers>
<customer id="135" birthDate="4/1/1968"> Paul Koch </customer>
<customer id="122" birthDate="7/5/1988"> Bob Kelly </customer>
<customer id="044" birthDate="3/24/1990"> Joe Healy </customer>
<customer id="982" birthDate="9/15/1974"> Matt Hink </customer>
<customer id="325" birthDate="1/7/2004"> Tom Perham </customer>
<customer id="134" birthDate="9/23/1946"> Jeff Hay </customer>
<customer id="653" birthDate="5/15/1947"> Kim Shane </customer>
<customer id="235" birthDate="4/24/1979"> Mike Ray </customer>
</customers>
You need to obtain a list of names of customers who are 21 years of age or older.
Which code segment should you use?
A.
XDocument customers = XDocument.Load("Customers.xml"); var results = from c in customers.Descendants("customer") where ((DateTime)c.Attribute("birthDate")).AddYears(21) < DateTime.Now select c.Attribute("Name");
B.
XDocument customers = XDocument.Load("Customers.xml"); var results = from c in customers.Descendants("customer") where ((DateTime)c.Attribute("birthDate")).AddYears(21) < DateTime.Now select new { FullName = c.Value };
C.
XDocument customers = XDocument.Load("Customers.xml"); var results = from c in customers.Descendants("customer") where ((DateTime)c.Attribute("birthDate")).AddYears(21) < DateTime.Now select c.Element("customer");
D.
XDocument customers = XDocument.Load("Customers.xml"); var results = from c in customers.Descendants() where ((DateTime)c.Attribute("birthDate")).AddYears(21) < DateTime.Now select new { FullName = c.Value };