Single statement across multiple lines in VB.NET without the underscore character

后端 未结 8 569
死守一世寂寞
死守一世寂寞 2020-12-09 07:42

Is there a way to have a statement across multiple lines without the underscore character?

It is really annoying in multi-line strings such as SQL statements, and es

8条回答
  •  余生分开走
    2020-12-09 08:19

    For most multiline strings using an XML element with an inner CDATA block is easier to avoid having to escape anything for simple raw string data.

    Dim s as string = .Value
    

    Note that I've seen many people state the same format but without the wrapping "< s >" tag (just the CDATA block) but visual studio Automatic formatting seams to alter the leading whitespace of each line then. I think this is due to the object inheritance structure behind the Linq "X" objects. CDATA is not a "Container", the outer block is an XElement which inherits from XContainer.

提交回复
热议问题