Try using one or more "<br/>" instead of Environment.NewLine. If you cannot change the first part, then use something like 'description = description.Replace(Environment.NewLine, "<br/>").
Two new lines in string
I have the following code snippet. I want to add two new lines after variable "automatedComment ". I tried the following way. But its taking only one line after the URL in automatedComment. Please let me know how can I add two lines after URL
string automatedComment = "<b>Note:</b>" + " Your comment will not be read." +
"For more details, " + "please refer the wiki <URL>";
string description = automatedComment + Environment.NewLine + "" +
"TEST MESSAGE" + Environment.NewLine + "" +
Environment.NewLine +
Environment.NewLine + "Logs path: " +
Environment.NewLine +
Environment.NewLine + Environment.NewLine + "<b>==== List of Similar " + " Test Projects With Same issue ====</b>" +
Environment.NewLine ;
description = description.Trim().Trim(Environment.NewLine.ToCharArray());
description = "<p>" + + description.Replace(Environment.NewLine, "</p><p>") + "</p>";
Kindly waiting for your inputs.
Thanks,
Santosh
Developer technologies C#
2 answers
Sort by: Most helpful
-
-
Timon Yang-MSFT 9,606 Reputation points
2021-05-28T02:13:18.757+00:00 This should be an html problem.
It is best not to use
<p></p>
to create a new line, even if you need to use it for some reason, it should be<p> </p>
.However, this method is not recommended. It is better to use
<br/>
according to Viorel-1's suggestion.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.