다음을 통해 공유


Environment.NewLine 속성

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

네임스페이스: System
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public Shared ReadOnly Property NewLine As String
‘사용 방법
Dim value As String

value = Environment.NewLine
public static string NewLine { get; }
public:
static property String^ NewLine {
    String^ get ();
}
/** @property */
public static String get_NewLine ()
public static function get NewLine () : String

속성 값

Unix 이외의 플랫폼에 사용되는 "\r\n"을 포함하는 문자열 또는 Unix 플랫폼에 사용되는 "\n"을 포함하는 문자열

설명

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

NewLine에서 제공하는 기능을 의미하는 용어는 줄 바꿈, 캐리지 리턴, CRLF, 줄의 끝 등 여러 가지가 있습니다.

NewLine은 Microsoft C# 및 C/C++의 이스케이프 문자인 '\r' 및 '\n' 또는 Microsoft Visual Basic의 vbCrLf와 같이 언어에 따라 다른 줄 바꿈 지원 기능과 함께 사용될 수 있습니다.

NewLineSystem.Console.WriteLine 메서드와 System.Text.StringBuilder.AppendLine 메서드에서 처리하는 텍스트에 자동으로 추가됩니다.

예제

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

' Sample for the Environment.NewLine property
Imports System

Class Sample
   Public Shared Sub Main()
      Console.WriteLine()
      Console.WriteLine("NewLine: {0}  first line{0}  second line{0}  third line", _
                             Environment.NewLine)
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'NewLine:
'  first line
'  second line
'  third line
'
// Sample for the Environment.NewLine property
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine();
    Console.WriteLine("NewLine: {0}  first line{0}  second line{0}  third line",
                          Environment.NewLine);
    }
}
/*
This example produces the following results:

NewLine:
  first line
  second line
  third line
*/
// Sample for the Environment::NewLine property
using namespace System;
int main()
{
   Console::WriteLine();
   Console::WriteLine( "NewLine: {0}  first line {0}  second line {0}  third line", Environment::NewLine );
}

/*
This example produces the following results:

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

class Sample
{
    public static void main(String[] args)
    {
        Console.WriteLine();
        Console.WriteLine("NewLine: {0}  first line{0}  second line{0}"
            + "  third line", Environment.get_NewLine());
    } //main
} //Sample
/*
This example produces the following results:

NewLine:
  first line
  second line
  third line
*/

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

Environment 클래스
Environment 멤버
System 네임스페이스