LINQ Queries with XML Literals

XML literals provide an alternative syntax for LINQ to XML queries in Visual Basic code. Let’s look at the first XML document used in “The System.Xml.Linq Namespace” section again, which looks like the following but with a slight modification:

<?xml version="1.0" encoding="utf-8"?><Contacts>  <Contact FirstName="Alessandro"        LastName="Del Sole"        Age="37"        Email="alessandro.delsole@visual-basic.it">  </Contact>  <!--The following are fantasy names-->  <Contact FirstName="Stephen"        LastName="Red"        Age="40"        Email="address1@something.com">  </Contact>  <Contact FirstName="Robert"        LastName="White"        Age="41"        Email="address2@something.com"> ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.