Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != GetType())
            {
                return(false);
            }

            var value = obj as ExternalModelTest;

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

            return
                (DateTest == value.DateTest &&
                 BinariesTest != null && value.BinariesTest != null &&
                 BinariesTest.Equals(value.BinariesTest) &&
                 CollectionOfCollectionTest != null && value.CollectionOfCollectionTest != null &&
                 CollectionOfCollectionTest.Equals(value.CollectionOfCollectionTest) &&
                 CollectionOfCollectionOfCollectionTest != null && value.CollectionOfCollectionOfCollectionTest != null &&
                 CollectionOfCollectionOfCollectionTest.Equals(value.CollectionOfCollectionOfCollectionTest));
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ DateTest.GetHashCode();
                hash = (hash * HashingMultiplier) ^
                       (!object.ReferenceEquals(null, BinariesTest) ? BinariesTest.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^
                       (!object.ReferenceEquals(null, CollectionOfCollectionTest) ? CollectionOfCollectionTest.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^
                       (!object.ReferenceEquals(null, CollectionOfCollectionOfCollectionTest) ? CollectionOfCollectionOfCollectionTest.GetHashCode() : 0);
                return(hash);
            }
        }