System.Security.Principal.WindowsImpersonationContext.Dispose Method

Releases all resources used by the System.Security.Principal.WindowsImpersonationContext.

Syntax

[System.Runtime.InteropServices.ComVisible(false)]
public void Dispose ()

Remarks

Call WindowsImpersonationContext.Dispose when you are finished using the System.Security.Principal.WindowsImpersonationContext. The WindowsImpersonationContext.Dispose method leaves the System.Security.Principal.WindowsImpersonationContext in an unusable state. After calling WindowsImpersonationContext.Dispose, you must release all references to the System.Security.Principal.WindowsImpersonationContext so the garbage collector can reclaim the memory that the System.Security.Principal.WindowsImpersonationContext was occupying. For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

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

Requirements

Namespace: System.Security.Principal
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0