Stream writer, with "

  • Thread starter Thread starter MFRASER
  • Start date Start date
M

MFRASER

How do I put a quote inside of a string I want to write the following out to
a text file.

aTextWriter.WriteLine("<XML Integration>" + System.Environment.NewLine);

aTextWriter.WriteLine("<IndexTag COLUMNS='""");



but the second line does not work.
 
MFRASER said:
How do I put a quote inside of a string I want to write the following out to
a text file.

aTextWriter.WriteLine("<XML Integration>" + System.Environment.NewLine);

aTextWriter.WriteLine("<IndexTag COLUMNS='""");

but the second line does not work.

Use \" - or "" within a verbatim string literal. In other words:

"x\"o\"x"
and
@"x""o""x"

both represent the string
x"o"x
 
Back
Top