StringWriter.Write 메서드

정의

문자열에 데이터를 씁니다.

오버로드

Name Description
Write(Char[], Int32, Int32)

문자열에 문자의 하위 배열을 씁니다.

Write(String)

현재 문자열에 문자열을 씁니다.

Write(StringBuilder)

문자열 작성기의 문자열 표현을 현재 문자열에 씁니다.

Write(Char)

문자열에 문자를 씁니다.

Write(ReadOnlySpan<Char>)

현재 문자열에 문자 범위의 문자열 표현을 씁니다.

Write(Char[], Int32, Int32)

Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs

문자열에 문자의 하위 배열을 씁니다.

public:
 override void Write(cli::array <char> ^ buffer, int index, int count);
public override void Write(char[] buffer, int index, int count);
override this.Write : char[] * int * int -> unit
Public Overrides Sub Write (buffer As Char(), index As Integer, count As Integer)

매개 변수

buffer
Char[]

데이터를 쓸 문자 배열입니다.

index
Int32

데이터 읽기를 시작할 버퍼의 위치입니다.

count
Int32

쓸 최대 문자 수입니다.

예외

buffernull입니다.

index 또는 count 음수입니다.

(index + count)>buffer. Length;

작성기가 닫혀 있습니다.

예제

이 코드 예제는 생성자에 대해 제공되는 더 큰 예제의 StringWriter() 일부입니다.

// Use the three overloads of the Write method that are
// overridden by the StringWriter class.
strWriter.Write("file path characters are: ");
strWriter.Write(
    Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
strWriter.Write('.');
' Use the three overloads of the Write method that are 
' overridden by the StringWriter class.
strWriter.Write("file path characters are: ")
strWriter.Write( _
    Path.InvalidPathChars, 0, Path.InvalidPathChars.Length)
strWriter.Write("."C)

설명

이 메서드는 TextWriter.Write를 재정의합니다.

이 메서드는 count 위치에서 StringWriter시작하여 데이터의 문자를 이 buffer 위치에 index씁니다.

다음 표에서는 다른 일반적인 또는 관련 I/O 작업의 예를 나열합니다.

이 작업을 수행하려면... 이 항목의 예제를 참조하세요.
텍스트 파일을 만듭니다. 방법: 파일에 텍스트 쓰기
텍스트 파일에 씁니다. 방법: 파일에 텍스트 쓰기
텍스트 파일에서 읽습니다. 방법: 파일에서 텍스트 읽기
파일에 텍스트를 추가합니다. 방법: 로그 파일 열기 및 추가

File.AppendText

FileInfo.AppendText
파일의 크기를 가져옵니다. FileInfo.Length
파일의 특성을 가져옵니다. File.GetAttributes
파일의 특성을 설정합니다. File.SetAttributes
파일이 있는지 확인합니다. File.Exists
이진 파일에서 읽습니다. 방법: 새로 만든 데이터 파일 읽기 및 쓰기
이진 파일에 씁니다. 방법: 새로 만든 데이터 파일 읽기 및 쓰기

추가 정보

적용 대상

Write(String)

Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs

현재 문자열에 문자열을 씁니다.

public:
 override void Write(System::String ^ value);
public override void Write(string value);
public override void Write(string? value);
override this.Write : string -> unit
Public Overrides Sub Write (value As String)

매개 변수

value
String

쓸 문자열입니다.

예외

작성기가 닫혀 있습니다.

예제

이 코드 예제는 클래스에 제공된 더 큰 예제의 StringWriter 일부입니다.

convertedCharacter = (char)intCharacter;
if(convertedCharacter == '.')
{
    strWriter.Write(".\n\n");

    // Bypass the spaces between sentences.
    strReader.Read();
    strReader.Read();
}
convertedCharacter = Convert.ToChar(intCharacter)
If convertedCharacter = "."C Then
    strWriter.Write("." & vbCrLf & vbCrLf)

    ' Bypass the spaces between sentences.
    strReader.Read()
    strReader.Read()

설명

이 메서드는 TextWriter.Write를 재정의합니다.

지정된 문자열이 null면 아무 것도 기록되지 않습니다.

다음 표에서는 다른 일반적인 또는 관련 I/O 작업의 예를 나열합니다.

이 작업을 수행하려면... 이 항목의 예제를 참조하세요.
텍스트 파일을 만듭니다. 방법: 파일에 텍스트 쓰기
텍스트 파일에 씁니다. 방법: 파일에 텍스트 쓰기
텍스트 파일에서 읽습니다. 방법: 파일에서 텍스트 읽기
파일에 텍스트를 추가합니다. 방법: 로그 파일 열기 및 추가

File.AppendText

FileInfo.AppendText
파일의 크기를 가져옵니다. FileInfo.Length
파일의 특성을 가져옵니다. File.GetAttributes
파일의 특성을 설정합니다. File.SetAttributes
파일이 있는지 확인합니다. File.Exists
이진 파일에서 읽습니다. 방법: 새로 만든 데이터 파일 읽기 및 쓰기
이진 파일에 씁니다. 방법: 새로 만든 데이터 파일 읽기 및 쓰기

추가 정보

적용 대상

Write(StringBuilder)

Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs

문자열 작성기의 문자열 표현을 현재 문자열에 씁니다.

public:
 override void Write(System::Text::StringBuilder ^ value);
public override void Write(System.Text.StringBuilder? value);
override this.Write : System.Text.StringBuilder -> unit
Public Overrides Sub Write (value As StringBuilder)

매개 변수

value
StringBuilder

문자열에 쓸 문자열 작성기입니다.

적용 대상

Write(Char)

Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs

문자열에 문자를 씁니다.

public:
 override void Write(char value);
public override void Write(char value);
override this.Write : char -> unit
Public Overrides Sub Write (value As Char)

매개 변수

value
Char

쓸 문자입니다.

예외

작성기가 닫혀 있습니다.

예제

이 코드 예제는 생성자에 대해 제공되는 더 큰 예제의 StringWriter() 일부입니다.

// Use the three overloads of the Write method that are
// overridden by the StringWriter class.
strWriter.Write("file path characters are: ");
strWriter.Write(
    Path.InvalidPathChars, 0, Path.InvalidPathChars.Length);
strWriter.Write('.');
' Use the three overloads of the Write method that are 
' overridden by the StringWriter class.
strWriter.Write("file path characters are: ")
strWriter.Write( _
    Path.InvalidPathChars, 0, Path.InvalidPathChars.Length)
strWriter.Write("."C)

설명

이 메서드는 TextWriter.Write를 재정의합니다.

다음 표에서는 다른 일반적인 또는 관련 I/O 작업의 예를 나열합니다.

이 작업을 수행하려면... 이 항목의 예제를 참조하세요.
텍스트 파일을 만듭니다. 방법: 파일에 텍스트 쓰기
텍스트 파일에 씁니다. 방법: 파일에 텍스트 쓰기
텍스트 파일에서 읽습니다. 방법: 파일에서 텍스트 읽기
파일에 텍스트를 추가합니다. 방법: 로그 파일 열기 및 추가

File.AppendText

FileInfo.AppendText
파일의 크기를 가져옵니다. FileInfo.Length
파일의 특성을 가져옵니다. File.GetAttributes
파일의 특성을 설정합니다. File.SetAttributes
파일이 있는지 확인합니다. File.Exists
이진 파일에서 읽습니다. 방법: 새로 만든 데이터 파일 읽기 및 쓰기
이진 파일에 씁니다. 방법: 새로 만든 데이터 파일 읽기 및 쓰기

추가 정보

적용 대상

Write(ReadOnlySpan<Char>)

Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs
Source:
StringWriter.cs

현재 문자열에 문자 범위의 문자열 표현을 씁니다.

public:
 override void Write(ReadOnlySpan<char> buffer);
public override void Write(ReadOnlySpan<char> buffer);
override this.Write : ReadOnlySpan<char> -> unit
Public Overrides Sub Write (buffer As ReadOnlySpan(Of Char))

매개 변수

buffer
ReadOnlySpan<Char>

문자열에 쓸 문자 범위입니다.

적용 대상