Share via


Dispose Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Releases all resources used by the Stream.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Sub Dispose
public void Dispose()
public:
virtual void Dispose() sealed
abstract Dispose : unit -> unit 
override Dispose : unit -> unit 
public final function Dispose()

Implements

IDisposable. . :: . .Dispose() () () ()

Remarks

This method disposes the stream, by writing any changes to the backing store and closing the stream to release resources. 

Calling Dispose allows the resources used by the Stream to be reallocated for other purposes. For more information about Dispose, see Cleaning Up Unmanaged Resources.

Notes to Implementers

Place all cleanup logic for your stream object in Stream..::..Dispose(Boolean). Do not override Close

.NET Framework Security

See Also

Reference

Stream Class

Dispose Overload

System.IO Namespace