METHOD

File.WriteAllText

Writes text to a file, replacing its existing contents if present.

Formal Syntax & Structure

csharp syntaxcsharp
File.WriteAllText(path, contents)

Working Example

Example Snippetcsharp
// Documentary fragment; see lesson for context and imports.File.WriteAllText(path, "[4]");
C# & .NET Reference