Code in c#:
Mailcontent= constant.mail+constant.mail;
Explanation:
First constant contain selected for 1st round
Second constant contain selected
how to add new line in code
Output:
Selected for 1st round
Selected
Code in c#:
Mailcontent= constant.mail+constant.mail;
Explanation:
First constant contain selected for 1st round
Second constant contain selected
how to add new line in code
Output:
Selected for 1st round
Selected
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh KumarRank #91 · 22.9K reputationPosted Apr 4, 2023, 12:41 AM EDT
Hello Meghana,
As Amit suggested you can use Environmnet.NewLine or you can use
for new line,
Mailcontent= constant.mail + " "+constant.mail;Uday DodiyaRank #239 · 10.3K reputationPosted Apr 4, 2023, 1:15 AM EDT
Hello,
If you're sending an HTML email, you can use an HTML line break tag
to add a new linestring Mailcontent = "" + constant.mail + " " + constant.mail + " ";If you're sending a plain text email, you can use the
"\r\n"sequence to add a new line.string Mailcontent = constant.mail + "\r\n" + constant.mail;Sachin SinghRank #66 · 26.2K reputationPosted Apr 4, 2023, 5:06 AM EDT
you need to do 2 things
1.
2.
MailMessage message = new MailMessage(); message.IsBodyHtml = true; message.Body=MailcontentAmit MohantyRank #112 · 20K reputationPosted Apr 4, 2023, 12:13 AM EDT
You can use
Environment.NewLineBrahma Prakash ShuklaRank #633 · 3.8K reputationPosted Apr 21, 2023, 2:35 AM EDT
To add a new line in the
Mailcontentstring in C#, you can use the newline character"\n"orEnvironment.NewLineconstant. Here's an example of how to modify your code to add a new line:makefileCopy code
Mailcontent = constant.mail + Environment.NewLine + constant.mail;or
makefileCopy code
Mailcontent = constant.mail + "\n" + constant.mail;In this modified code, we are adding a new line between the two
constant.mailstrings using theEnvironment.NewLineconstant or the"\n"character.This will result in the
Mailcontentstring having a new line between the two constants when displayed or sent as an email.Tuhin PaulRank #7 · 71.9K reputationPosted Apr 22, 2023, 10:25 PM EDT
To add a new line between the two constants, you can use the `Environment.NewLine` property in C#. See below:
Here `Environment.NewLine` is added between the two constants to create a new line in the `Mailcontent` string. This will produce the following output:
Selected for 1st round SelectedEach constant will appear on a new line.
Anandu G NathRank #681 · 3.5K reputationPosted Dec 27, 2023, 3:40 AM EST