Represents a wrapper class for handle resources.
Assembly: mscorlib (in mscorlib.dll)
Thetype exposes the following members.
|Close||Marks the handle for releasing and freeing resources.|
|Dispose()||Releases all resources used by the .|
|Dispose(Boolean)||Releases the unmanaged resources used by the class specifying whether to perform a normal dispose operation.|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Frees all resources associated with the handle. (Overrides CriticalFinalizerObject.Finalize().)|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|ReleaseHandle||When overridden in a derived class, executes the code required to free the handle.|
|SetHandle||Sets the handle to the specified pre-existing handle.|
|SetHandleAsInvalid||Marks a handle as invalid.|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The class is similar to the SafeHandle class, except that SafeHandle implements reference counting. You can use instead of SafeHandle to address performance considerations when you can provide the necessary synchronization more efficiently yourself.
Because the class does not perform reference counting, it does not provide protection from handle recycling security attacks. Because the reference counting algorithm implicitly serializes operations, a certain amount of thread safety is also lost. If you call the IDisposable.Dispose or Close method while an operation that is using the handle is outstanding on another thread, or if you call IDisposable.Dispose or Close from two threads at the same time, the results are non-deterministic. The class still provides the guaranteed critical finalization provided by the CriticalFinalizerObject class.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.