Beispiel #1
0
 public int GetHashCode(IdNameNullable <TKey> obj)
 {
     unchecked
     {
         return((EqualityComparer <TKey?> .Default.GetHashCode(obj.Id) * 397) ^ (obj.Name != null ? obj.Name.GetHashCode() : 0));
     }
 }
Beispiel #2
0
        public bool Equals(IdNameNullable <TKey> x, IdNameNullable <TKey> y)
        {
            if (ReferenceEquals(x, y))
            {
                return(true);
            }
            if (ReferenceEquals(x, null))
            {
                return(false);
            }
            if (ReferenceEquals(y, null))
            {
                return(false);
            }
            if (x.GetType() != y.GetType())
            {
                return(false);
            }

            return(EqualityComparer <TKey?> .Default.Equals(x.Id, y.Id) && string.Equals(x.Name, y.Name));
        }
Beispiel #3
0
 public bool Equals(IdNameNullable <TKey> other)
 {
     return(Equals(this, other));
 }