System.Net.Sockets.SafeOverlappedFree.SafeOverlappedFree.ReleaseHandle C# (CSharp) Method

ReleaseHandle() protected method

protected ReleaseHandle ( ) : bool
return bool
        unsafe override protected bool ReleaseHandle()
        {
            SafeCloseSocket socketHandle = _socketHandle;
            if (socketHandle != null && !socketHandle.IsInvalid)
            {
                // We are being finalized while the I/O operation associated
                // with the current overlapped is still pending (e.g. on app
                // domain shutdown). The socket has to be closed first to
                // avoid reuse after delete of the native overlapped structure.
                socketHandle.Dispose();
            }

            // Release the native overlapped structure.
            return Interop.Kernel32.LocalFree(handle) == IntPtr.Zero;
        }
    }
SafeOverlappedFree.SafeOverlappedFree