System.Internal.HandleCollector.HandleType.Remove C# (CSharp) Method

Remove() private method

private Remove ( IntPtr handle ) : IntPtr
handle System.IntPtr
return System.IntPtr
            internal IntPtr Remove(IntPtr handle) {
                if( handle == IntPtr.Zero )
                {
                    return handle;
                }
                int currentCount = 0;
                lock(this) {
                    handleCount--;
#if DEBUG_HANDLECOLLECTOR
                    Debug.Assert(handles.Contains(handle));
                    handles.Remove(handle);
#endif
                    if (handleCount < 0) {
                        System.Diagnostics.Debug.Fail("Handle collector underflow for type '" + name + "'");
                        handleCount = 0;
                    }
                    currentCount = handleCount;
                }
                lock (internalSyncObject){
                    if (HandleCollector.HandleRemoved != null) {
                        HandleCollector.HandleRemoved(name, handle, currentCount);
                    }
                }
                return handle;
                
            }
        }