System.IO.TextWriter.Dispose Method

Releases all resources used by the System.IO.TextWriter object.

Syntax

public void Dispose ()

Remarks

Call TextWriter.Dispose when you are finished using the System.IO.TextWriter. The TextWriter.Dispose method leaves the System.IO.TextWriter in an unusable state. After calling TextWriter.Dispose, you must release all references to the System.IO.TextWriter so the garbage collector can reclaim the memory that the System.IO.TextWriter was occupying.

For more information, see [<topic://cpconCleaningUpUnmanagedResources>] and Implementing a Dispose Method.

Note   Always call TextWriter.Dispose before you release your last reference to the System.IO.TextWriter. Otherwise, the resources it is using will not be freed until the garbage collector calls the System.IO.TextWriter object's object.Finalize method.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0