Esempio n. 1
0
        /// <summary>
        /// Returns a value indicating whether this instance and a specified Object represent the same type and value.
        /// </summary>
        /// <param name="obj">The object to compare with this instance.</param>
        /// <returns><c>true</c> if <paramref name="obj"/> is a <see cref="Atomic{T}"/> and equal to this instance; otherwise, <c>false</c>.</returns>
        public override bool Equals(object obj)
        {
            Atomic <T> other = obj as Atomic <T>;

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

            return(object.ReferenceEquals(this, other) || this.Value.Equals(other.Value));
        }
Esempio n. 2
0
 /// <summary>
 /// Returns a value indicating whether this instance and a specified <see cref="Atomic{T}"/> object represent the same value.
 /// </summary>
 /// <param name="other">An object to compare to this instance.</param>
 /// <returns><c>true</c> if <paramref name="other"/> is equal to this instance; otherwise, <c>false</c>.</returns>
 public bool Equals(Atomic <T> other)
 {
     return(!object.ReferenceEquals(other, null) && (object.ReferenceEquals(this, other) || this.Value.Equals(other.Value)));
 }
Esempio n. 3
0
 public LockBasedAtomic(Atomic <T> atomic)
 {
     _atomic = atomic;
 }