Free Information Technology Magazines and eBooks

Sunday, June 21, 2009

Visual Basic 2010 : Implicit Line Continuation

The new Visual Basic 2010 or Visual Basic 10 already supports implicit line continuation which no longer use the underscore character (_). For a more details on this new feature, you can watch the video of the interview with Doug Rothaus, a programming writer on the Visual Studio User Education team. Elimination of those pesky underscore is a good thing to VB programmers because it makes our code more readable especially when writing multi-line LINQ queries.



Visual Basic 2010 : Implicit Line Continuation

So from using underscore (_)

Dim sMyString As String = "This is " & _
" a " & _
" test "

Console.WriteLine(sMyString)


Now you, don't need it anymore

Dim sMyString As String = "This is " &
" a " &
" test "

Console.WriteLine(sMyString)


How about Multiple statements in a single line?


Dim sMyString As String = "This is " & " a " & " test " : Console.WriteLine(sMyString)


For more VB.NET tips & tricks, subscribe now.

0 comments: