471,334 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Quotes in C#

Hello,

I have the following code:

StringBuilder paper = new StringBuilder();
paper.AppendLine(string.Format("<div id=""Document""
class=""ScribdIPaper""></div>", client));

In VB.NET "" in a string translates into a ".

In C# this is not working. How can I make this render the "?

Thanks,
Miguel
Sep 8 '08 #1
4 1500
shapper wrote:
Hello,

I have the following code:

StringBuilder paper = new StringBuilder();
paper.AppendLine(string.Format("<div id=""Document""
class=""ScribdIPaper""></div>", client));

In VB.NET "" in a string translates into a ".

In C# this is not working. How can I make this render the "?
paper.AppendLine(string.Format(
"<div id=\"Document\" class=\"ScribdIPaper\"></div>", client));
--
Rudy Velthuis http://rvelthuis.de

"Learning is what most adults will do for a living in the 21st
century." -- Perelman
Sep 8 '08 #2
"shapper" <md*****@gmail.comwrote in message
news:49**********************************@z72g2000 hsb.googlegroups.com...
In VB.NET "" in a string translates into a ".

In C# this is not working. How can I make this render the "?
\"
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 8 '08 #3
On Sep 9, 3:16*am, shapper <mdmo...@gmail.comwrote:
Hello,

I have the following code:

StringBuilder paper = new StringBuilder();
paper.AppendLine(string.Format("<div id=""Document""
class=""ScribdIPaper""></div>", client));

In VB.NET "" in a string translates into a ".

In C# this is not working. How can I make this render the "?

Thanks,
Miguel
use \"

-Cnu
Sep 9 '08 #4
shapper wrote:
Hello,

I have the following code:

StringBuilder paper = new StringBuilder();
paper.AppendLine(string.Format("<div id=""Document""
class=""ScribdIPaper""></div>", client));

In VB.NET "" in a string translates into a ".

In C# this is not working. How can I make this render the "?

Thanks,
Miguel
You either escape the quotation mark using a backslash:

paper.AppendLine(string.Format("<div id=\"Document\"
class=\"ScribdIPaper\"></div>", client));

Or use an @-delimited string:

paper.AppendLine(string.Format(@"<div id=""Document""
class=""ScribdIPaper""></div>", client));
There is something missing in your code, though. There is no format
specifier in the format string, so the client value isn't included in
the string.

--
Göran Andersson
_____
http://www.guffa.com
Sep 9 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Martin Goldman | last post: by
6 posts views Thread by Cyrus D. | last post: by
11 posts views Thread by Jakanapes | last post: by
4 posts views Thread by Gerald Aichholzer | last post: by
4 posts views Thread by (PeteCresswell) | last post: by
3 posts views Thread by Balaskas Evaggelos | last post: by
4 posts views Thread by Michael Yanowitz | last post: by
5 posts views Thread by Brigitte Behrmann | last post: by

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.