Home All Groups Group Topic Archive Search About

Convert C# "writer.Write(@" to VB ?

Author
12 Oct 2006 3:40 PM
bh
I'm trying to convert the following statement to VB.NET:
    writer.Write(@"<some html here>");

I tried simply removing the semicolon, but VB chokes on the @-sign.
Unfortunately, when searching online, I can't find any information on what
this actually does in the  c# code, otherwise I'd simply remove it.  What
does the @ symbolize, here, and how can I effectively rewrite this in VB?

Thanks  in advance.

bh

Author
12 Oct 2006 3:53 PM
Chris Fulstow
The "@" sign makes it a verbatim string, so you don't need to escape
backslashes.
More info:
http://www.c-sharpcorner.com/1/verbatim_literals.asp

bh wrote:
Show quoteHide quote
> I'm trying to convert the following statement to VB.NET:
>     writer.Write(@"<some html here>");
>
> I tried simply removing the semicolon, but VB chokes on the @-sign.
> Unfortunately, when searching online, I can't find any information on what
> this actually does in the  c# code, otherwise I'd simply remove it.  What
> does the @ symbolize, here, and how can I effectively rewrite this in VB?
>
> Thanks  in advance.
>
> bh
Author
12 Oct 2006 3:59 PM
rmacias
Take out the @ character.  In C# this tells the compiler ignore escape
squences such as "\n" and "\r", etc.

For example:  Console.WriteLine("Hello\nWorld") will output :

Hello
World

But Console.WriteLine(@"Hello\World") will output:

Hello\nWorld

Show quoteHide quote
"bh" wrote:

> I'm trying to convert the following statement to VB.NET:
>     writer.Write(@"<some html here>");
>
> I tried simply removing the semicolon, but VB chokes on the @-sign.
> Unfortunately, when searching online, I can't find any information on what
> this actually does in the  c# code, otherwise I'd simply remove it.  What
> does the @ symbolize, here, and how can I effectively rewrite this in VB?
>
> Thanks  in advance.
>
> bh
>
>
>
Author
12 Oct 2006 4:04 PM
Christof Nordiek
you can't find any information about it?
In the C#-documentation look for string or string literal.
In short the @ changes the characters and escape sequences that can be used
in a string literal.
since the verbatim string literal is very Basic like, removing the @ will be
right.

(the @ in C# also has another meaning in connection with
keywords/indentifiers)

Show quoteHide quote
"bh" <NoSpam@ReplyToGroup.com> schrieb im Newsbeitrag
news:%23h5efVh7GHA.3644@TK2MSFTNGP03.phx.gbl...
> I'm trying to convert the following statement to VB.NET:
>    writer.Write(@"<some html here>");
>
> I tried simply removing the semicolon, but VB chokes on the @-sign.
> Unfortunately, when searching online, I can't find any information on what
> this actually does in the  c# code, otherwise I'd simply remove it.  What
> does the @ symbolize, here, and how can I effectively rewrite this in VB?
>
> Thanks  in advance.
>
> bh
>
Author
12 Oct 2006 5:55 PM
Jon Paal
vb doesn't require the "@" sign -- dump it too..



Show quoteHide quote
"bh" <NoSpam@ReplyToGroup.com> wrote in message news:%23h5efVh7GHA.3644@TK2MSFTNGP03.phx.gbl...
> I'm trying to convert the following statement to VB.NET:
>    writer.Write(@"<some html here>");
>
> I tried simply removing the semicolon, but VB chokes on the @-sign. Unfortunately, when searching online, I can't find any
> information on what this actually does in the  c# code, otherwise I'd simply remove it.  What does the @ symbolize, here, and how
> can I effectively rewrite this in VB?
>
> Thanks  in advance.
>
> bh
>
Author
12 Oct 2006 10:32 PM
Herfried K. Wagner [MVP]
"bh" <NoSpam@ReplyToGroup.com> schrieb:
> I'm trying to convert the following statement to VB.NET:
>    writer.Write(@"<some html here>");

Simply remove the '@':

C# Programmer's Reference -- 'string'
<URL:http://msdn.microsoft.com/library/en-us/csref/html/vclrfString.asp>

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>