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

Remove() public method

public Remove ( IntPtr handle ) : bool
handle System.IntPtr
return bool
            public bool Remove(IntPtr handle) {
                lock(this) {
                    int hash = ComputeHash(handle);
                    if (CompModSwitches.HandleLeak.Level >= TraceLevel.Info) {
                        Debug.WriteLine("-------------------------------------------------");
                        Debug.WriteLine("Handle Releaseing: " + Convert.ToString((int)handle, 16));
                        Debug.WriteLine("Handle Type      : " + name);
                        if (CompModSwitches.HandleLeak.Level >= TraceLevel.Verbose)
                            Debug.WriteLine(Environment.StackTrace);
                    }
                    HandleEntry e = buckets[hash];
                    HandleEntry last = null;
                    while (e != null && e.handle != handle) {
                        last = e;
                        e = e.next;
                    }
                    if (e != null) {
                        if (last == null) {
                            buckets[hash] = e.next;
                        }
                        else {
                            last.next = e.next;
                        }
                        handleCount--;
                        return true;
                    }
                    return false;
                }
            }