Escape Character

G

Guest

In C#, it has a escape chatacter @ then can ingnore all the escape charactrer
in string, how about in VB.NET, any escape character like @?
Thank you
 
L

Lucas Tam

In C#, it has a escape chatacter @ then can ingnore all the escape
charactrer in string, how about in VB.NET, any escape character like

I don't believe so.

Just double all quotes.
 
C

C

HK guy said:
In C#, it has a escape chatacter @ then can ingnore all the escape charactrer
in string, how about in VB.NET, any escape character like @?
Thank you

No, In VB.NET, you can find the special character in module
Microsoft.VisualBasic.ControlChars. These constants are equivalent to escape
characters of C#.
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?SEsgZ3V5?= said:
In C#, it has a escape chatacter @ then can ingnore all the escape charactrer
in string, how about in VB.NET, any escape character like @?

There are no escape characters. Notice that a single quote must be
"encoded" as two single quotes inside a string literal. For special
characters, take a look at 'ControlChars':

\\\
Dim s As String = "Hello" & ControlChars.NewLine & "World"
///

There is no runtime performance loss because the compiler will determine
that this is a single constant and store it as a single constant in the
executable file.
 
C

Cor Ligthert

Herfried,
\\\
Dim s As String = "Hello" & ControlChars.NewLine & "World"
///

There is no runtime performance loss because the compiler will determine
that this is a single constant and store it as a single constant in the
executable file.

It can be true however what the hell of a loss of performance this could
be, even when it is in a loop which goes a billion times it would be less
than a millisecond probably.

:)

Cor
 
H

Herfried K. Wagner [MVP]

* "Cor Ligthert said:
It can be true however what the hell of a loss of performance this could
be, even when it is in a loop which goes a billion times it would be less
than a millisecond probably.

Full ACK. I only wanted to make sure that the OP doesn't think VB.NET
isn't as clever as C# ;-).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top