Exemplo n.º 1
0
 static void M1(FieldB b, FieldC c)
 {
     b.Field = new object();
     b.CallM(); // no flow
     c.Field = new object();
     c.CallM(); // flow
 }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            unchecked
            {
                int hash  = 17;
                int prime = 23;

                hash = hash * prime + FieldA.GetHashCode();
                hash = hash * prime + FieldB.GetHashCode();
                hash = hash * prime + FieldC.GetHashCode();
                hash = hash * prime + FieldD.GetHashCode();

                return(hash);
            }
        }
        /// <summary>
        /// Указывает, эквивалентен ли текущий объект другому объекту того же типа.
        /// </summary>
        /// <param name="other">Объект, который требуется сравнить с данным объектом.</param>
        /// <returns>
        /// <see langword="true" />, если текущий объект эквивалентен параметру <paramref name="other" />, в противном случае — <see langword="false" />.
        /// </returns>
        public bool Equals(SecondSerializableClass other)
        {
            bool equal = FieldA.Equals(other.FieldA) && SomeProperty.Equals(other.SomeProperty);

            if (FieldC != null && !FieldC.Equals(other.FieldC))
            {
                equal = false;
            }
            if (Array1 != null && !Array1.SequenceEqual(other.Array1))
            {
                equal = false;
            }
            if (SomeClasses != null && !SomeClasses.SequenceEqual(other.SomeClasses))
            {
                equal = false;
            }

            return(equal);
        }