Mono Class Library: Microsoft.Win32.SafeHandles Namespace

Microsoft.Win32.SafeHandles.SafeFileHandle Class

A SafeHandle for file descriptors. [Edit]

See Also: SafeFileHandle Members

System.Object
     System.Runtime.ConstrainedExecution.CriticalFinalizerObject
          System.Runtime.InteropServices.SafeHandle
               Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
                    Microsoft.Win32.SafeHandles.SafeFileHandle

public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid

Remarks

This is a type safe System.Runtime.InteropServices.SafeHandle that wraps file descriptors.

Application developers should use SafeFileHandles instead of IntPtr for storing file handles, as SafeFileHandles will ensure that file descriptors are properly closed (even in the presence of an AppDomain unload) and will prevent problems like handle reuse.

SafeHandles can be used in P/Invoke parameters, P/Invoke return values and structures passed to unmanaged code.

[Edit]

Requirements

Namespace: Microsoft.Win32.SafeHandles
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: