Dropping the Underscore in VB for Line Continuation

Visual Basic added a feature in 2010 for implicit line continuation. This enables you to drop the need for the underscore (_) commonly used to indicate line continuation. For example, the following code shows a valid method signature without the need for the underscore required for line continuation.

Private Sub OnEmployeeUpdate(ByVal sender As Object,
  ByVal e As EmployeeUpdatedEventArgs)

There are many places in Visual Basic where you can eliminate the underscore and instead allow the compiler to use implicit continuation. These include after commas, after an open parenthesis, after an open curly brace, after concatenation, and more.


Tip

Visual Basic 14 (for Visual Studio 2015) now allows for multiline string literals.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset