File.ReadAllLinesAsync Método

Definição

Sobrecargas

ReadAllLinesAsync(String, CancellationToken)

Abre um arquivo de texto de forma assíncrona, lê todas as linhas dele e, em seguida, fecha o arquivo.Asynchronously opens a text file, reads all lines of the file, and then closes the file.

ReadAllLinesAsync(String, Encoding, CancellationToken)

Abre um arquivo de texto de forma assíncrona, lê todas as linhas dele com a codificação especificada e, em seguida, fecha o arquivo.Asynchronously opens a text file, reads all lines of the file with the specified encoding, and then closes the file.

ReadAllLinesAsync(String, CancellationToken)

Abre um arquivo de texto de forma assíncrona, lê todas as linhas dele e, em seguida, fecha o arquivo.Asynchronously opens a text file, reads all lines of the file, and then closes the file.

public static System.Threading.Tasks.Task<string[]> ReadAllLinesAsync (string path, System.Threading.CancellationToken cancellationToken = default);
static member ReadAllLinesAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string[]>
Public Shared Function ReadAllLinesAsync (path As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String())

Parâmetros

path
String

O arquivo a ser aberto para leitura.The file to open for reading.

cancellationToken
CancellationToken

O token a se monitorar para solicitações de cancelamento.The token to monitor for cancellation requests. O valor padrão é None.The default value is None.

Retornos

Task<String[]>

Uma tarefa que representa a operação de leitura assíncrona, que encapsula a matriz de cadeia de caracteres que contém todas as linhas do arquivo.A task that represents the asynchronous read operation, which wraps the string array containing all lines of the file.

Aplica-se a

ReadAllLinesAsync(String, Encoding, CancellationToken)

Abre um arquivo de texto de forma assíncrona, lê todas as linhas dele com a codificação especificada e, em seguida, fecha o arquivo.Asynchronously opens a text file, reads all lines of the file with the specified encoding, and then closes the file.

public static System.Threading.Tasks.Task<string[]> ReadAllLinesAsync (string path, System.Text.Encoding encoding, System.Threading.CancellationToken cancellationToken = default);
static member ReadAllLinesAsync : string * System.Text.Encoding * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string[]>
Public Shared Function ReadAllLinesAsync (path As String, encoding As Encoding, Optional cancellationToken As CancellationToken = Nothing) As Task(Of String())

Parâmetros

path
String

O arquivo a ser aberto para leitura.The file to open for reading.

encoding
Encoding

A codificação aplicada ao conteúdo do arquivo.The encoding applied to the contents of the file.

cancellationToken
CancellationToken

O token a se monitorar para solicitações de cancelamento.The token to monitor for cancellation requests. O valor padrão é None.The default value is None.

Retornos

Task<String[]>

Uma tarefa que representa a operação de leitura assíncrona, que encapsula a matriz de cadeia de caracteres que contém todas as linhas do arquivo.A task that represents the asynchronous read operation, which wraps the string array containing all lines of the file.

Aplica-se a