public override bool Equals(object obj)
            {
                if (obj == this)
                {
                    return(true);
                }
                if (obj == null)
                {
                    return(false);
                }

                HashedWeakReference other = obj as HashedWeakReference;

                if (other == null)
                {
                    return(false);
                }

                if (GetHashCode() != other.GetHashCode())
                {
                    return(false);
                }

                return(EqualityComparer <object> .Default.Equals(Target, other.Target));
            }
        private static Timer CreateTimer(HashedWeakReference <CancellationTokenSource> key)
        {
            CancellationTokenSource cts = key.Target;

            if (cts == null)
            {
                throw new InvalidOperationException();
            }

            TimerState state = new TimerState(cts);
            Timer      timer = new Timer(TimeElapsed, state, Timeout.Infinite, Timeout.Infinite);

            state.Timer = timer;
            return(timer);
        }