The below code help you to add newline char in a string using two different methods. Please comment if you face any problem while using this.
C# Example to Add newline in a string:
using System;
namespace MyApp
{
class newline_class
{
static void Main()
{
string site1 = "SoftwareTestingNet.com";
string site2 = "SharepointBank.com";
Console.WriteLine(site1 + Environment.NewLine + site2);
Console.WriteLine(site1 + "\n" + site2);
Console.Read();
}
}
}
No comments:
Post a Comment