StreamWriter.Dispose Method

Definition

Releases the unmanaged resources used by the StreamWriter and optionally releases the managed resources.

protected override void Dispose (bool disposing);
Parameters
disposing
Boolean

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Exceptions

The current encoding does not support displaying half of a Unicode surrogate pair.

Remarks

When the disposing parameter is true, this method releases all resources held by any managed objects that this StreamWriter references. This method invokes the Dispose method of each referenced object.