Exemplo n.º 1
0
 public bool Equals(VersionedRedisEntry <T> other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(EqualityComparer <T> .Default.Equals(Data, other.Data) && Version == other.Version);
 }
Exemplo n.º 2
0
        public int CompareTo(VersionedRedisEntry <T> other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var comp = Version.CompareTo(other.Version);

            if (comp != 0)
            {
                return(comp);
            }

            if (ReferenceEquals(Data, other.Data))
            {
                return(0);
            }
            if (ReferenceEquals(null, Data))
            {
                return(1);
            }
            if (ReferenceEquals(null, other.Data))
            {
                return(-1);
            }

            if (!(Data is IComparable <T> comparableData))
            {
                return(0);
            }

            return(comparableData.CompareTo(other.Data));
        }