• Advertisement
Sign in to follow this  

using double quote in a C# string

This topic is 4159 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need to use the " character in a C# string. Obviousely when I use " " " the compiler considers the second double quote as a closing quote and discards the third one. How can I override this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You can also use '@' before your quoted string to tell it to ignore the escape characters:
string file = @"C:\my\file\is\here.txt";
Console.WriteLine(file);

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Rob Loach
You can also use '@' before your quoted string to tell it to ignore the escape characters:string file = @"C:\my\file\is\here.txt";
Console.WriteLine(file);
How would one add a "-character then?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement