At a low level, the function works by converting the expression to an XAttribute or XElement node depending on the location. Under the hood, expressions are simply converted to the appropriate XAttribute or XElement constructor.
The most instructive way to understand what is happening here is to look at the decompiled code output. Or even the equivalent of the C # VB XML literal. This blog post has a small post on the subject.
source
share