Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid Class

Provides a base class for Win32 safe handle implementations in which the value of either 0 or -1 indicates an invalid handle.

See Also: SafeHandleZeroOrMinusOneIsInvalid Members


public abstract class SafeHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle


This class derives from the System.Runtime.InteropServices.SafeHandle class. It describes the format of an invalid handle. For example, some handles use -1 as an invalid handle value, while others use 0. Further derivations of this class (for example, file or registry handles) can specialize this further. See the Microsoft.Win32.SafeHandles.SafeFileHandle class for an example of a class that derives from Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid.

Use the Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid class whenever you need to safely wrap an unmanaged resource that does not have an existing managed wrapper.


Namespace: Microsoft.Win32.SafeHandles
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0