다음을 통해 공유


방법: 여러 줄 문자열 리터럴 생성(Visual C#)

업데이트: 2007년 11월

이 예제에서는 여러 줄로 된 문자열 리터럴을 생성하는 두 가지 방법을 보여 줍니다.

예제

string myString1 = "This is the first line of my string.\n" +
                   "This is the second line of my string.\n" +
                   "This is the third line of the string.\n";
string myString2 = @"This is the first line of my string.
This is the second line of my string.
This is the third line of the string.";

코드 컴파일

코드를 복사한 다음 콘솔 응용 프로그램의 Main 메서드에 붙여넣습니다.

참고 항목

개념

C# 언어 입문

기타 리소스

Visual C# Express