Reputation: 7877
I how i make string in multiple lines in VS2010 and using C#. I have a HTML markup as a string and it is filling in a code behind(cs) as in the designer page(aspx). How to i make it in one line or which character i have to put at the end of line so that string will be concatenating next lines. Below is the string sample.
string text="<table> <tr> <td> <table border=\"1\" cellpadding=\"0\" style=\"mso-cellspacing: 1.5pt; mso-border-alt: outset black .75pt; mso-yfti-tbllook: 1184;
mso-padding-alt: 1.5pt 1.5pt 1.5pt 1.5pt; height: 264px; width: 100%; font-size: 10.0pt; border: 1.0pt outset black; font-family: Times New Roman, serif; \">
<tr style=\"mso-yfti-irow:0;mso-yfti-firstrow:yes\">
Upvotes: 1
Views: 1671
Reputation: 499062
Use a verbatim string literal for this - they are declared by using a @
before the string declaration. The "
escape on those is ""
.
string text= @"<table> <tr> <td> <table border=""1"" cellpadding=""0"" style=""mso-cellspacing: 1.5pt; mso-border-alt: outset black .75pt; mso-yfti-tbllook: 1184;
mso-padding-alt: 1.5pt 1.5pt 1.5pt 1.5pt; height: 264px; width: 100%; font-size: 10.0pt; border: 1.0pt outset black; font-family: Times New Roman, serif; "">
<tr style=""mso-yfti-irow:0;mso-yfti-firstrow:yes"">";
Upvotes: 4
Reputation: 300
Add a @ in front of the first "
like this: string text = @"This is on
multiple lines";
Upvotes: 0