Environment.NewLine 속성

정의

이 환경에 대해 정의된 줄 바꿈 문자열을 가져옵니다.

public:
 static property System::String ^ NewLine { System::String ^ get(); };
public static string NewLine { get; }
member this.NewLine : string
Public Shared ReadOnly Property NewLine As String

속성 값

String

\r\n 비 Unix 플랫폼 또는 \n Unix 플랫폼의 경우

예제

다음 예제에서는 줄 바꿈으로 구분된 두 줄을 표시합니다.

// Sample for the Environment::NewLine property
using namespace System;

int main()
{
   Console::WriteLine();
   Console::WriteLine("NewLine: {0}  first line {0}  second line", Environment::NewLine);
}

/*
This example produces the following results:

NewLine:
first line
second line
*/
// Sample for the Environment.NewLine property
using System;

class Sample
{
    public static void Main()
    {
        Console.WriteLine();
        Console.WriteLine($"NewLine: {Environment.NewLine}  first line{Environment.NewLine}  second line");
    }
}

/*
This example produces the following results:

NewLine:
  first line
  second line
*/
// Sample for the Environment.NewLine property
open System

printfn $"\nNewLine: {Environment.NewLine}  first line{Environment.NewLine}  second line"

// This example produces the following results:
//     NewLine:
//       first line
//       second line
' Sample for the Environment.NewLine property
Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine($"NewLine:{Environment.NewLine}  first line{Environment.NewLine}  second line")
   End Sub
End Class

'This example produces the following results:
'
'NewLine:
'  first line
'  second line
'

설명

속성 값 NewLine 은 현재 플랫폼 및 .NET Framework 구현을 위해 특별히 사용자 지정된 상수입니다. 속성 값의 이스케이프 문자에 대한 자세한 내용은 문자 이 스케이프를 참조하세요.

제공되는 NewLine 기능은 줄 바꿈, 줄 바꿈, 줄 바꿈, 캐리지 리턴, CRLF 및 줄 끝이라는 용어가 의미하는 경우가 많습니다.

NewLine는 Microsoft C# 및 C/C++의 이스케이프 문자 '\r' 및 '\n'와 같은 언어별 줄 바꿈 지원 또는 vbCrLf Microsoft Visual Basic 함께 사용할 수 있습니다.

NewLine는 및 StringBuilder.AppendLine 메서드에 의해 처리되는 텍스트에 Console.WriteLine 자동으로 추가됩니다.

적용 대상