Skip to content
CShift0.32

StreamWriter

Struct · namespace System · Since 0.19

struct StreamWriter : IDisposable

Writes text to a file as UTF-8.

Name Description
Create Creates a new, empty text file (an existing one is truncated).
Append Opens a text file for writing at its end; it is created if it does not exist.
static IoError<StreamWriter> Create(StringSlice path)

Creates a new, empty text file (an existing one is truncated).

Errors

static IoError<StreamWriter> Append(StringSlice path)

Opens a text file for writing at its end; it is created if it does not exist.

Errors

Name Description
Write Writes text.
WriteLine Writes text and a line break (\n).
Flush Writes what is still buffered to the file.
Close Closes the file.
Dispose Closes the file (StreamWriter.Close); using calls it.
IoError<void> Write(StringSlice text)

Writes text.

Errors

IoError<void> WriteLine(StringSlice text)

Writes text and a line break (\n).

Errors

IoError<void> WriteLine()

Writes a line break (\n).

Errors

void Flush()

Writes what is still buffered to the file.

void Close()

Closes the file.

void Dispose()

Closes the file (StreamWriter.Close); using calls it.