Represents a wrapper class for handle resources.
Assembly: mscorlib (in mscorlib.dll)
Initializes a new instance of theclass with the specified invalid handle value.
Marks the handle for releasing and freeing resources.
Releases all resources used by the.
Releases the unmanaged resources used by theclass specifying whether to perform a normal dispose operation.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
Frees all resources associated with the handle.(Overrides CriticalFinalizerObject.Finalize().)
Serves as the default hash function. (Inherited from Object.)
When overridden in a derived class, executes the code required to free the handle.
Sets the handle to the specified pre-existing handle.
Marks a handle as invalid.
Returns a string that represents the current object.(Inherited from Object.)
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.class is similar to the
Because 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.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
for full trust for inheritors. This member cannot be inherited by partially trusted code.
requires full trust for the immediate caller. This class cannot be used by partially trusted or transparent code.
Available since 4.5
Available since 2.0
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 8.0
Available since 8.1
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.