共用方式為


Environment.NewLine Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the newline string defined for this environment.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared ReadOnly Property NewLine As String
public static string NewLine { get; }

Property Value

Type: System.String
A string containing "\r\n" for non-Unix platforms,
or
a string containing "\n" for Unix platforms.

Remarks

The property value of NewLine is a constant customized specifically for the current platform and implementation of the .NET Framework.

The functionality provided by NewLine is often what is meant by the terms newline, line feed, line break, carriage return, CRLF, and end of line.

NewLine can be used in conjunction with language-specific newline support such as the escape characters '\r' and '\n' in Microsoft C# and C/C++, or vbCrLf in Microsoft Visual Basic.

NewLine is automatically appended to text processed by the Console.WriteLine and StringBuilder.AppendLine methods.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference