METHOD

File.ReadAllTextAsync

Returns a task that reads text and observes the supplied cancellation token.

Formal Syntax & Structure

csharp syntaxcsharp
File.ReadAllTextAsync(path, cancellationToken)

Working Example

Example Snippetcsharp
// Documentary fragment; see lesson for context and imports.string text = await File.ReadAllTextAsync(path, source.Token);
C# & .NET Reference