StringReader.ReadToEndAsync 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
오버로드
| Name | Description |
|---|---|
| ReadToEndAsync() |
현재 위치에서 문자열 끝까지 모든 문자를 비동기적으로 읽고 단일 문자열로 반환합니다. |
| ReadToEndAsync(CancellationToken) |
현재 위치에서 문자열 끝까지 모든 문자를 비동기적으로 읽고 단일 문자열로 반환합니다. |
ReadToEndAsync()
- Source:
- StringReader.cs
- Source:
- StringReader.cs
- Source:
- StringReader.cs
- Source:
- StringReader.cs
- Source:
- StringReader.cs
현재 위치에서 문자열 끝까지 모든 문자를 비동기적으로 읽고 단일 문자열로 반환합니다.
public:
override System::Threading::Tasks::Task<System::String ^> ^ ReadToEndAsync();
public override System.Threading.Tasks.Task<string> ReadToEndAsync();
[System.Runtime.InteropServices.ComVisible(false)]
public override System.Threading.Tasks.Task<string> ReadToEndAsync();
override this.ReadToEndAsync : unit -> System.Threading.Tasks.Task<string>
[<System.Runtime.InteropServices.ComVisible(false)>]
override this.ReadToEndAsync : unit -> System.Threading.Tasks.Task<string>
Public Overrides Function ReadToEndAsync () As Task(Of String)
반품
비동기 읽기 작업을 나타내는 작업입니다. 매개 변수의 TResult 값에는 현재 위치에서 문자열의 끝까지의 문자가 있는 문자열이 포함됩니다.
- 특성
예외
문자 수가 Int32.MaxValue보다 큰 경우
문자열 판독기를 삭제했습니다.
판독기는 현재 이전 읽기 작업에서 사용 중입니다.
예제
다음 예제에서는 전체 문자열을 비동기적으로 읽는 방법을 보여줍니다.
using System;
using System.IO;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
ReadCharacters();
}
static async void ReadCharacters()
{
StringBuilder stringToRead = new StringBuilder();
stringToRead.AppendLine("Characters in 1st line to read");
stringToRead.AppendLine("and 2nd line");
stringToRead.AppendLine("and the end");
using (StringReader reader = new StringReader(stringToRead.ToString()))
{
string readText = await reader.ReadToEndAsync();
Console.WriteLine(readText);
}
}
}
}
// The example displays the following output:
//
// Characters in 1st line to read
// and 2nd line
// and the end
//
Imports System.IO
Imports System.Text
Module Module1
Sub Main()
ReadCharacters()
End Sub
Async Sub ReadCharacters()
Dim stringToRead = New StringBuilder()
stringToRead.AppendLine("Characters in 1st line to read")
stringToRead.AppendLine("and 2nd line")
stringToRead.AppendLine("and the end")
Using reader As StringReader = New StringReader(stringToRead.ToString())
Dim readText As String = Await reader.ReadToEndAsync()
Console.WriteLine(readText)
End Using
End Sub
End Module
' The example displays the following output:
'
' Characters in 1st line to read
' and 2nd line
' and the end
'
설명
이 메서드는 메서드의 동기 대응이 throw할 수 있는 모든 비사용 예외를 반환하는 작업에 저장됩니다. 예외가 반환된 작업에 저장되면 태스크가 대기될 때 해당 예외가 throw됩니다. ArgumentException같은 사용 예외는 여전히 동기적으로 던져집니다. 저장된 예외는 .에 의해 ReadToEnd()throw된 예외를 참조하세요.
적용 대상
ReadToEndAsync(CancellationToken)
- Source:
- StringReader.cs
- Source:
- StringReader.cs
- Source:
- StringReader.cs
- Source:
- StringReader.cs
- Source:
- StringReader.cs
현재 위치에서 문자열 끝까지 모든 문자를 비동기적으로 읽고 단일 문자열로 반환합니다.
public:
override System::Threading::Tasks::Task<System::String ^> ^ ReadToEndAsync(System::Threading::CancellationToken cancellationToken);
public override System.Threading.Tasks.Task<string> ReadToEndAsync(System.Threading.CancellationToken cancellationToken);
override this.ReadToEndAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
Public Overrides Function ReadToEndAsync (cancellationToken As CancellationToken) As Task(Of String)
매개 변수
- cancellationToken
- CancellationToken
취소 요청을 모니터링할 토큰입니다.
반품
비동기 읽기 작업을 나타내는 작업입니다. 매개 변수의 TResult 값에는 현재 위치에서 문자열의 끝까지의 문자가 있는 문자열이 포함됩니다.
예외
문자 수가 Int32.MaxValue보다 큰 경우
문자열 판독기를 삭제했습니다.
판독기는 현재 이전 읽기 작업에서 사용 중입니다.
취소 토큰이 취소되었습니다. 이 예외는 반환된 작업에 저장됩니다.
설명
이 메서드는 메서드의 동기 대응이 throw할 수 있는 모든 비사용 예외를 반환하는 작업에 저장됩니다. 예외가 반환된 작업에 저장되면 태스크가 대기될 때 해당 예외가 throw됩니다. ArgumentException같은 사용 예외는 여전히 동기적으로 던져집니다. 저장된 예외는 .에 의해 ReadToEnd()throw된 예외를 참조하세요.