Hello I need Newline Character which works with both i.e C# and HTML I know That in C# We can use,
System.Environment.NewLine or "\r\n"
and in Html We can use,
<br/>
What is the alternative to this?
That depends on where you intend using that new line. For text files, use NewLine
or \r\n
. For HTML documents, use <br/>
.
As you wrote in the comments:
I want to write log in log file and also send that log via mail as html body.
So you would need to seperate the two cases.
For breaking a line in your log file, use \r\n
or System.Environment.NewLine
.
For breaking a line in your HTML body, use <br/>
.
For using the log as an HTML document body, you can simply use:
string body = logFileConent.Replace(@"\r\n", "<br/>");
Where logFileConent
is a string variable holding your text file lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With