Example #1
0
        public void GetHashCode_On_Event()
        {
            using var src1 = new EventSource <String>();
            using var src2 = new EventSource <String>();

            Check.That(src1.Event.GetHashCode())
            .Not.IsEqualTo(0);

            Check.That(src2.Event.GetHashCode())
            .Not.IsEqualTo(0);

            Check.That(src1.GetHashCode())
            .Not.IsEqualTo(src2.GetHashCode());
        }
Example #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (version_ != null)
            {
                hash ^= Version.GetHashCode();
            }
            if (eventSource_ != null)
            {
                hash ^= EventSource.GetHashCode();
            }
            if (artifact_ != null)
            {
                hash ^= Artifact.GetHashCode();
            }
            return(hash);
        }
Example #3
0
        /// <summary>
        /// Detaches this eventwrapper to be able to GC it later
        /// </summary>
        /// <param name="pathDetach">True if in middle path (just for debugging, doesnt matter which value is passed)</param>
        public void Detach(bool pathDetach = false)
        {
            if (PropertyFilter != null)
            {
                EventSource.PropertyChanged -= SourcePropertyChanged;
            }
            else
            {
                EventSource.PropertyChanged -= PathPropertyChanged;
            }
#if DEBUG
            if (pathDetach)
            {
                Debug.WriteLine("Path detach: " + EventSource.GetType().Name + ":" + EventSource.GetHashCode() + " from " + PropertyFilter);
            }
            else
            {
                Debug.WriteLine("Final detach: " + EventSource.GetType().Name + ":" + EventSource.GetHashCode());
            }
#endif
        }
Example #4
0
 /// <summary>
 ///     Returns the hash code for the current instance.
 /// </summary>
 ///
 /// <returns>
 ///     A 32-bit signed integer hash code.
 /// </returns>
 public readonly override Int32 GetHashCode()
 {
     return(mSource?.GetHashCode() ?? 0);
 }