473,409 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

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

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
Oct 12 '06 #1
5 1680
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:
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
Oct 12 '06 #2
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

"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
Oct 12 '06 #3
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)

"bh" <No****@ReplyToGroup.comschrieb im Newsbeitrag
news:%2****************@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

Oct 12 '06 #4
vb doesn't require the "@" sign -- dump it too..

"bh" <No****@ReplyToGroup.comwrote in message news:%2****************@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

Oct 12 '06 #5
"bh" <No****@ReplyToGroup.comschrieb:
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/>
Oct 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
2
by: Joel Moore | last post by:
Maybe I'm just easily baffled after an all-nighter but I can't seem to figure out how to represent a BitArray as a hexadecimal string. For example: Dim outputBank As New BitArray(8) ...
4
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
5
by: Cally | last post by:
Hello, I would like to convert a field from ntext field found in one database table to float field found in another database table. The reason why I want to do this is a long one. I have...
7
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
3
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
6
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
1
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.