コード例 #1
0
        public static bool Equals(MergeOperation <Relationship> op, object obj)
        {
            MergeOperation <Relationship> other = (MergeOperation <Relationship>)obj;

            if (op.DisplayName != other.DisplayName)
            {
                return(false);
            }

            if (op.Object != other.Object)
            {
                return(false);
            }

            if (op.ToString() != other.ToString())
            {
                return(false);
            }

            if (op.ChangesToNote.Count() != other.ChangesToNote.Count())
            {
                return(false);
            }

            for (int i = 0; i < op.ChangesToNote.Count(); i++)
            {
                if (op.ChangesToNote.ElementAt(i).ObjectToInspect != other.ChangesToNote.ElementAt(i).ObjectToInspect ||
                    op.ChangesToNote.ElementAt(i).TextForUser != other.ChangesToNote.ElementAt(i).TextForUser)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
        public static int GetHashCode(MergeOperation <Relationship> op)
        {
            int hash = op.DisplayName.GetHashCode() ^ op.ToString().GetHashCode() ^ op.ChangesToNote.Count();

            foreach (var change in op.ChangesToNote)
            {
                hash = hash ^ change.GetHashCode();
            }

            return(hash);
        }