Share via


DirectoryEntry.Dispose (Boolean)

The Dispose method disposes of the resources (other than memory) used by the DirectoryEntry.

protected void Dispose(
  Boolean disposing
);
Protected Sub Dispose( _
  ByVal disposing As Boolean _
)

Parameters

  • disposing
    Set to true to release both managed and unmanaged resources; false to release only unmanaged resources.

Return Values

This method has no return values.

Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code.

Remarks

This method is called by the public Dispose() method and the Finalize method. Dispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. Finalize invokes Dispose() with disposing set to false.

When the disposing parameter is true, this method releases all resources held by any managed objects that this DirectoryEntry references. This method invokes the Dispose() method of each referenced object.

Notes to Inheritors: Dispose can be called multiple times by other objects. When overriding Dispose(Boolean), be careful not to reference objects that have been previously disposed of in an earlier call to Dispose. For more information about how to implement Dispose, see Implementing a Dispose Method.

For more information about Dispose and Finalize, see Cleaning Up Unmanaged Resources and Overriding the Finalize Method.

Requirements

Client Requires Windows XP Home Edition, Windows XP Professional, Windows Me, or Windows 98.
Server Requires Windows Server 2003, Windows 2000, or Windows NT 4.0.
Namespace

Defined in System.DirectoryServices.

Assembly

Requires System.DirectoryServices (in System.DirectoryServices.dll).

.NET Framework

Requires .NET Framework 1.0.

See Also

DirectoryEntry Class, DirectoryEntry Methods, DirectoryEntry Members (Visual J# Syntax), Managed Extensions for C++ Programming, System.DirectoryServices Namespace