METHOD

File.ReadAllText

Reads the entire text from a file and closes it. Bound the input first when needed.

Formal Syntax & Structure

csharp syntaxcsharp
File.ReadAllText(path)

Working Example

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