Growing into Learning LINQ to XML

So I forced myself last night to spend time learning LINQ to XML, both from a technical perspective and a theoretical perspective. My aim is to not only know what LINQ to XML is but also to understand why and how. My goal for the next six months is to not skim over source code, but to actually spend time going through it and trying to understand it, and the same applies to LINQ to XML.

I started off with the MSDN article, and my goal is to go through all of the material and to get a good overview of the technology as well as knowing the code that goes with it. So I will try and learn as much of code as possible.

From what I read last night I found a few facts about LINQ to XML interesting:

  • It is a built-in language feature. I already knew this actually. And because it is a built-in language feature it gets to use debugging features as well as be strongly typed
  • LINQ to XML is equivalent to a redesigned XML DOM. You write query expressions that are equivalent to XQuery and XPath in functionality (not syntax).
  • It uses something called functional construction
  • You can create and manipulate XML by saving it, serializing it or sending it over the net
  • The query expression are SQL-like:
    IEnumerable items = from items in purchaseOrder.Descendants(“Items”)
    where (int)items.Element(“Quantity”) * (decimal)items.Element(“USPrice”) > 100
    orderby (string)items.Element(“PartNumber”)
    select items;
    The above sample is taken directly from MSDN
  • Share/Bookmark

Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes