Alex Rivera | Logout

Multiline strings in VB.NET

Asked 2009-04-01T16:36:48.567
162

Is there a way to have multiline strings in VB.NET like Python

a = """
multi
line
string
"""

or PHP?

$a = <<<END
multi
line
string
END;

Of course something that is not

"multi" & _
"line
Edit
Report

1 Answer

52

VB.Net has no such feature and it will not be coming in Visual Studio 2010. The feature that jirwin is refering is called implicit line continuation. It has to do with removing the _ from a multi-line statement or expression. This does remove the need to terminate a multiline string with _ but there is still no mult-line string literal in VB.

Example for multiline string

Visual Studio 2008

Dim x = "line1" & vbCrlf & _
        "line2"

Visual Studio 2010

Dim x = "line1" & vbCrlf & 
        "line2"
answered 2009-04-01T18:59:09.347

Your Answer