SafeHandle

SafeHandle


Represents a wrapper class for operating system handles. This class must be implemented.


Public:

Properties:

NameDescription
 IsClosed (get) Indicates if the SafeHandle is considered closed.  
 IsInvalid (get) Indicates if the wrapped handle is considered invalid.  

Methods:

NameDescription
 CloseHandle Attempts to close the handle by raising the ReleaseHandle event.  
 DangerousGetHandle Returns the wrapped handle.  

Events:

NameDescription
 ReleaseHandle 

Remarks

This class should be implemented using the Implements keyword for usage within the system.

The class also manages the lifetime of a given handle. It should be used within a custom safe-handle implementation and handle the ReleaseHandle event to peform clean-up for the specific handle in implementations.

An example of implementing and using SafeHandle is SafeFileHandle.

See Also

Project CorLib Overview

Class SafeHandle Overview