Welcome to MSDN Blogs Sign in | Join | Help

Long strings in Visual Basic 2008

I suspect everyone already knew this – but for me it was shiny and new :-) XML Literals do not require line continuation characters, hence rather than this:

   1: Dim msg1 As String = "this is a " & _
   2:                     "really, " & _
   3:                     "really " & _
   4:                     "long string"

you can create a really long string using an XML Literal:

   1: Dim msg1 = <s>This is a
   2:                 really,
   3:                 really
   4:                 long string</s>.Value

Note: the whitespace is maintained.

Published Monday, October 06, 2008 10:34 PM by Eric Nelson

Comments

Monday, October 06, 2008 5:41 PM by Long strings in Visual Basic 2008 : EasyCoded

# Long strings in Visual Basic 2008 : EasyCoded

Anonymous comments are disabled
 
Page view tracker