Mono Class Library: System.Net.Sockets.NetworkStream Overview | Members

System.Net.Sockets.NetworkStream.Dispose Method

Releases the unmanaged resources used by the current instance and optionally releases the managed resources. [Edit]

protected override void Dispose (bool disposing)

Parameters

disposing
A bool. Specify true to release both managed and unmanaged resources; specify false to release only unmanaged resources. [Edit]

Remarks

Note:

Ownership of a socket is specified using the System.Net.Sockets.NetworkStream constructor.

The NetworkStream.Close method calls this method with the disposing parameter set to true. The finalizer calls this method with the disposing parameter set to false.

Operation
This method closes the current System.Net.Sockets.NetworkStream instance releasing all unmanaged resources allocated by the current instance. When the underlying socket is owned by the current instance, the Socket.Close method of the socket is called, which frees the managed and unmanaged resources used by the socket. When the disposing parameter is true , this method also releases all resources held by any other managed objects allocated by the current instance.

This method closes the current System.Net.Sockets.NetworkStream instance releasing all unmanaged resources allocated by the current instance. When the underlying socket is owned by the current instance, the Socket.Close method of the socket is called, which frees the managed and unmanaged resources used by the socket.

Note to Inheritors
The Socket.Dispose(bool) method can be called multiple times by other objects. When overriding this method, do not reference objects that have been previously disposed in an earlier call.

Usage
Use this method to release resources allocated by the current instance.

[Edit]

Requirements

Namespace: System.Net.Sockets
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0