Gets the newline string for the current platform.
A string containing the characters required to write a newline.
This property is read-only.
Note: This property is intended for platform-independent formatting of multi-line strings. This value is automatically appended to text when using WriteLine methods, such as Console.WriteLine .
The following example demonstrates using the Environment.NewLine property. The string returned by Environment.NewLine is inserted between "Hello" and "World", causing a line break between the words in the output.
C# Example
using System; class TestClass { public static void Main() { Console.WriteLine("Hello,{0}World", Environment.NewLine); } }The output is
Hello,
World
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0