Microsoft.Win32.SafeHandles.SafeFileHandle.Open C# (CSharp) Method

Open() static private method

Opens a SafeFileHandle for a file descriptor created by a provided delegate.
static private Open ( Func fdFunc ) : SafeFileHandle
fdFunc Func /// The function that creates the file descriptor. Returns the file descriptor on success, or an invalid /// file descriptor on error with Marshal.GetLastWin32Error() set to the error code. ///
return SafeFileHandle
        internal static SafeFileHandle Open(Func<SafeFileHandle> fdFunc)
        {
            SafeFileHandle handle = Interop.CheckIo(fdFunc());

            Debug.Assert(!handle.IsInvalid, "File descriptor is invalid");
            return handle;
        }

Same methods

SafeFileHandle::Open ( string path, Interop flags, int mode ) : SafeFileHandle