conver VB Chr(34) to C#

Chr(34) is the double quote " . Since you can't put double quotes in a string ex:
"double " don't work here"  
In VB I could get a double quote into a line by creating a string using Chr(34).

    quote = Chr(34)
    txtLine = "<?xml version=" + quote + "1.0" + quote + " encoding =" + _
    quote + "Windows-1252" + quote + " ?>"

This needs to be converted..

I found the following:

string quote = (char)34;

does not work, it gives me the error,   "Cannot implicitly convert type 'char' to 'string' "..

Is there a way to do this in C#

Who is Participating?
Keego7237Connect With a Mentor Commented:
Or, if you want the quote variable

string quote = "\"";
txtLine = "<?xml version=\"1.0\" encoding = \"Windows-1252\" ?>"

using \" in the string will do it
moosetrackerAuthor Commented:
Thank you, Your solution worked quite nicely.. I knew to use that to escape out of a \  in a string, ex "\\".. But did not know it would work here too..

I had seen something else that said the escape charactor was anothe double quote in front..
So it would have been 4 ".. That did not work.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.