Share via


IDisposable.Dispose Method

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

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Releases all resources used by the Socket.

Namespace:  System.Net.Sockets
Assembly:  System (in System.dll)

Syntax

'Declaration
Private Sub Dispose Implements IDisposable.Dispose
void IDisposable.Dispose()
private:
virtual void Dispose() sealed = IDisposable::Dispose
private abstract Dispose : unit -> unit 
private override Dispose : unit -> unit 
JScript does not support explicit interface implementations.

Implements

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

Remarks

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

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

.NET Framework Security

See Also

Reference

Socket Class

System.Net.Sockets Namespace