Computer >> Computer tutorials >  >> Programming >> C#

Environment.NewLine in C#


The Enviornment.NewLine in C# is used to add newline.

To set a new line in between words −

str = "This is demo text!" + Environment.NewLine + "This is demo text on next line!";

The following is the code −

Example

using System;
using System.IO;
namespace Demo {
   class Program {
      static void Main(string[] args) {
         string str = "This is demo text!" + Environment.NewLine + "This is demo text on next line!";
         Console.Write(str);
      }
   }
}

Output

This is demo text!
This is demo text on next line!