Beispiel #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 19;
         foreach (var foo in PushNotifications.Select(p => p.ShipmentKey).Union(PushNotifications.Select(p => p.InventoryKey)))
         {
             hash = hash * 31 + foo.GetHashCode();
         }
         return(hash);
     }
 }
Beispiel #2
0
        public bool Equals(UserMessage other) // Compare the ShipmentKeys and the InventoryKeys
        {
            if (other == null)
            {
                return(false);
            }

            var keys      = PushNotifications.Select(p => p.ShipmentKey).Concat(PushNotifications.Select(p => p.InventoryKey)).ToList();
            var otherkeys = other.PushNotifications.Select(p => p.ShipmentKey).Concat(other.PushNotifications.Select(p => p.InventoryKey)).ToList();

            var comparer1 = keys.Except(otherkeys);
            var comparer2 = otherkeys.Except(keys);

            return(Message == other.Message && !comparer1.Any() && !comparer2.Any());
        }