Editing XML Literals Embedded Expressions in Visual Basic 2010 (Avner Aharoni)

Editing XML Literals Embedded Expressions in Visual Basic 2010 (Avner Aharoni)

Rate This
  • Comments 2

The implicit line continuation feature in Visual Basic 2010 provided an opportunity to improve the code editing experience in XML literals embedded expressions. In Visual Studio 2008, pressing Enter inside an embedded expression would result in the cursor being positioned to the left of the end embedded expression tag. In Visual Studio 2010, pressing Enter inserts a newline for the cursor, and the end embedded expression tag moves to the line below. This minimizes the number of key strokes needed to nicely format an embedded expression.

Example 1: Pressing Enter in an empty embedded expression

1) Starting point:

clip_image002

2) Result after pressing Enter in Visual Studio 2008:

clip_image006

3) Result after pressing Enter in Visual Studio 2010:

clip_image004

Example 2: Pressing Enter at the end of a line in a LINQ query

1) Starting point:

clip_image008

2) Result after pressing Enter in Visual Studio 2008:

clip_image012

3) Result after pressing Enter in Visual Studio 2010:

clip_image010

This example also uses the new VB array literals feature in Visual Studio 2010 as the query source.



Leave a Comment
  • Please add 1 and 8 and type the answer here:
  • Post
  • Very nice. These little touches really make a difference.

  • XML Literals are awesome and the implementation in VB10 is extremely intuitive.

Page 1 of 1 (2 items)