mscorlib 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.CriticalFinalizerObject System.IDisposable SafeHandles provide a typesafe mechanism to encapsulate operating system handles.

In the past, developers used the as an opaque value that typically mapped to operating system handles. There were two major problems with this: there was no type safety and on sandboxed setups it was possible to create an attack depending on handle reuse while some code executed in the underlying operating system.

SafeHandles are derived from this class and have to provide the proper mechanism for disposing a handle (file handles would close th underling operating system descriptor for example) and so so by overwritting the ReleaseHandle method.

SafeHandles and its derived types are passed in Platform Invocation calls (DllImports) and the runtime will transform the actual type-safe SafeHandle into the opaque handle (the runtime will call DangerousGetHandle () transparently).

In P/Invoke, SafeHandles can be passed as parameters and as reference parameters. They can be returned from methods and passed in structures. There is one limitation though: SafeHandles contained in ref structures will not have their values modified on the structure (In .NET or in Mono).

For an up-to-date description of all the features of SafeHandles in Mono see the page.

.NET 2.0
- Constructor
  To be added.
  To be added.
  To be added.
  To be added.
  System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
  2.0.0.0
  4.0.0.0
- Method
  System.Void To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void `` To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.MayFail)
- Method
  System.IntPtr To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void `` To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void To be added. To be added. 2.0.0.0 4.0.0.0
- Field
  System.IntPtr To be added. To be added. 2.0.0.0 4.0.0.0
- Property
  System.Boolean To be added. To be added. To be added. 2.0.0.0 4.0.0.0 get: System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Property
  System.Boolean To be added. To be added. To be added. 2.0.0.0 4.0.0.0 get: System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Boolean To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void `` To be added. To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)
- Method
  System.Void To be added. To be added. 2.0.0.0 4.0.0.0 System.Runtime.ConstrainedExecution.ReliabilityContract(System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)