Sponsored Ad

Sunday, March 13, 2011

How to Add Newline into a String using C#

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.

How to Add Newline into a String using C#

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

Sponsored Ad

Development Updates