Understanding Embedded Expressions

With embedded expressions you can include local variables or perform dynamic queries within Xml literals. For example, let’s look again at the first example about Xml literals, where an Xml document contains a couple of contacts. Imagine you want to generate a contact starting from some variables (that you could populate at runtime with different values) instead of hard-coding the last name, first name, and age. This can be accomplished as follows:

image

Although the second contact in the list is equal to the first example, the first contact is generated with embedded expressions. You create an embedded expression ...

Get Visual Basic® 2010 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.