Freigeben über


Stream.Dispose Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Releases all resources used by the Stream.

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

Syntax

'Declaration
Public Sub Dispose
public void 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.

Notes to Implementers

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

Note that because of backward compatibility requirements, this method's implementation differs from the recommended guidance for the Dispose pattern.  This method calls Close, which then calls Stream.Dispose(Boolean).

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.