Mono Class Library: System.Environment Overview | Members

System.Environment.NewLine Property

Gets the newline string for the current platform.

public static string NewLine { get; }

Value

A string containing the characters required to write a newline.

Remarks

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 .

Example

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

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0