StringBuilder.AppendLine 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
기본 줄 종결자 또는 지정된 문자열의 복사본과 기본 줄 종결자를 이 인스턴스의 끝에 추가합니다.
오버로드
| Name | Description |
|---|---|
| AppendLine() |
현재 StringBuilder 개체의 끝에 기본 줄 종결자를 추가합니다. |
| AppendLine(String) |
지정된 문자열의 복사본을 추가한 다음 기본 줄 종결자를 현재 StringBuilder 개체의 끝에 추가합니다. |
| AppendLine(StringBuilder+AppendInterpolatedStringHandler) |
지정된 보간된 문자열과 기본 줄 종결자를 현재 StringBuilder 개체의 끝에 추가합니다. |
| AppendLine(IFormatProvider, StringBuilder+AppendInterpolatedStringHandler) |
지정된 형식을 사용하여 보간된 문자열을 추가한 다음 기본 줄 종결자를 현재 StringBuilder 개체의 끝에 추가합니다. |
AppendLine()
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
현재 StringBuilder 개체의 끝에 기본 줄 종결자를 추가합니다.
public:
System::Text::StringBuilder ^ AppendLine();
public System.Text.StringBuilder AppendLine();
[System.Runtime.InteropServices.ComVisible(false)]
public System.Text.StringBuilder AppendLine();
member this.AppendLine : unit -> System.Text.StringBuilder
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.AppendLine : unit -> System.Text.StringBuilder
Public Function AppendLine () As StringBuilder
반환
추가 작업이 완료된 후 이 인스턴스에 대한 참조입니다.
- 특성
예외
이 인스턴스의 값을 확대하면 을 초과 MaxCapacity합니다.
예제
다음 예제에서는 메서드를 보여 줍니다 AppendLine .
// This example demonstrates the StringBuilder.AppendLine()
// method.
using System;
using System.Text;
class Sample
{
public static void Main()
{
StringBuilder sb = new StringBuilder();
string line = "A line of text.";
int number = 123;
// Append two lines of text.
sb.AppendLine("The first line of text.");
sb.AppendLine(line);
// Append a new line, an empty string, and a null cast as a string.
sb.AppendLine();
sb.AppendLine("");
sb.AppendLine((string)null);
// Append the non-string value, 123, and two new lines.
sb.Append(number).AppendLine().AppendLine();
// Append two lines of text.
sb.AppendLine(line);
sb.AppendLine("The last line of text.");
// Convert the value of the StringBuilder to a string and display the string.
Console.WriteLine(sb.ToString());
}
}
/*
This example produces the following results:
The first line of text.
A line of text.
123
A line of text.
The last line of text.
*/
// This example demonstrates the StringBuilder.AppendLine()
// method.
open System.Text
let sb = StringBuilder()
let line = "A line of text."
let number = 123
// Append two lines of text.
sb.AppendLine "The first line of text." |> ignore
sb.AppendLine line |> ignore
// Append a new line, an empty string, and a null cast as a string.
sb.AppendLine() |> ignore
sb.AppendLine "" |> ignore
sb.AppendLine Unchecked.defaultof<string> |> ignore
// Append the non-string value, 123, and two new lines.
sb.Append(number).AppendLine().AppendLine() |> ignore
// Append two lines of text.
sb.AppendLine line |> ignore
sb.AppendLine "The last line of text." |> ignore
// Convert the value of the StringBuilder to a string and display the string.
printfn $"{sb}"
// This example produces the following results:
// The first line of text.
// A line of text.
//
//
//
// 123
//
// A line of text.
// The last line of text.
' This example demonstrates the StringBuilder.AppendLine()
' method.
Imports System.Text
Class Sample
Public Shared Sub Main()
Dim sb As New StringBuilder()
Dim line As String = "A line of text."
Dim number As Integer = 123
' Append two lines of text.
sb.AppendLine("The first line of text.")
sb.AppendLine(line)
' Append a new line, an empty string, and a null cast as a string.
sb.AppendLine()
sb.AppendLine("")
sb.AppendLine(CStr(Nothing))
' Append the non-string value, 123, and two new lines.
sb.Append(number).AppendLine().AppendLine()
' Append two lines of text.
sb.AppendLine(line)
sb.AppendLine("The last line of text.")
' Convert the value of the StringBuilder to a string and display the string.
Console.WriteLine(sb.ToString())
End Sub
End Class
'
'This example produces the following results:
'
'The first line of text.
'A line of text.
'
'
'
'123
'
'A line of text.
'The last line of text.
설명
기본 줄 종결자는 속성의 Environment.NewLine 현재 값입니다.
이 인스턴스의 용량은 필요에 따라 조정됩니다.
호출자 참고
.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder 하여 개체를 인스턴스화 StringBuilder(Int32, Int32) 할 때 인스턴스의 StringBuilder 길이와 용량이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 작은 문자열을 추가하기 위해 메서드를 Append(String)AppendFormat(String, Object) 호출할 때 특히 발생할 수 있습니다.
추가 정보
적용 대상
AppendLine(String)
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
지정된 문자열의 복사본을 추가한 다음 기본 줄 종결자를 현재 StringBuilder 개체의 끝에 추가합니다.
public:
System::Text::StringBuilder ^ AppendLine(System::String ^ value);
public System.Text.StringBuilder AppendLine(string value);
public System.Text.StringBuilder AppendLine(string? value);
[System.Runtime.InteropServices.ComVisible(false)]
public System.Text.StringBuilder AppendLine(string value);
member this.AppendLine : string -> System.Text.StringBuilder
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.AppendLine : string -> System.Text.StringBuilder
Public Function AppendLine (value As String) As StringBuilder
매개 변수
- value
- String
추가할 문자열입니다.
반환
추가 작업이 완료된 후 이 인스턴스에 대한 참조입니다.
- 특성
예외
이 인스턴스의 값을 확대하면 을 초과 MaxCapacity합니다.
설명
기본 줄 종결자는 속성의 Environment.NewLine 현재 값입니다.
이 인스턴스의 용량은 필요에 따라 조정됩니다.
호출자 참고
.NET Core 및 .NET Framework 4.0 이상 버전에서 생성자를 호출 StringBuilder 하여 개체를 인스턴스화 StringBuilder(Int32, Int32) 할 때 인스턴스의 StringBuilder 길이와 용량이 속성 MaxCapacity 값을 초과하여 증가할 수 있습니다. 이 문제는 작은 문자열을 추가하기 위해 메서드를 Append(String)AppendFormat(String, Object) 호출할 때 특히 발생할 수 있습니다.
추가 정보
적용 대상
AppendLine(StringBuilder+AppendInterpolatedStringHandler)
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
지정된 보간된 문자열과 기본 줄 종결자를 현재 StringBuilder 개체의 끝에 추가합니다.
public:
System::Text::StringBuilder ^ AppendLine(System::Text::StringBuilder::AppendInterpolatedStringHandler % handler);
public System.Text.StringBuilder AppendLine(ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler);
member this.AppendLine : AppendInterpolatedStringHandler -> System.Text.StringBuilder
Public Function AppendLine (ByRef handler As StringBuilder.AppendInterpolatedStringHandler) As StringBuilder
매개 변수
추가할 보간된 문자열입니다.
반환
추가 작업이 완료된 후 이 인스턴스에 대한 참조입니다.
적용 대상
AppendLine(IFormatProvider, StringBuilder+AppendInterpolatedStringHandler)
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
- Source:
- StringBuilder.cs
지정된 형식을 사용하여 보간된 문자열을 추가한 다음 기본 줄 종결자를 현재 StringBuilder 개체의 끝에 추가합니다.
public:
System::Text::StringBuilder ^ AppendLine(IFormatProvider ^ provider, System::Text::StringBuilder::AppendInterpolatedStringHandler % handler);
public System.Text.StringBuilder AppendLine(IFormatProvider? provider, ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler);
member this.AppendLine : IFormatProvider * AppendInterpolatedStringHandler -> System.Text.StringBuilder
Public Function AppendLine (provider As IFormatProvider, ByRef handler As StringBuilder.AppendInterpolatedStringHandler) As StringBuilder
매개 변수
- provider
- IFormatProvider
문화권별 서식 정보를 제공하는 개체입니다.
추가할 보간된 문자열입니다.
반환
추가 작업이 완료된 후 이 인스턴스에 대한 참조입니다.