Binarysharp.MemoryManagement.Helpers.HandleManipulator.CloseHandle C# (CSharp) Method

CloseHandle() public static method

Closes an open object handle.
public static CloseHandle ( IntPtr handle ) : void
handle System.IntPtr A valid handle to an open object.
return void
        public static void CloseHandle(IntPtr handle)
        {
            // Check if the handle is valid
            ValidateAsArgument(handle, "handle");

            // Close the handle
            if(!NativeMethods.CloseHandle(handle))
                throw new Win32Exception("Couldn't close the handle correctly.");
        }