Exemplo n.º 1
0
        private bool Equals(ArrayTypeSymbol other, TypeCompareKind comparison)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if ((object)other == null || !other.HasSameShapeAs(this) ||
                !other.ElementType.Equals(ElementType, comparison))
            {
                return(false);
            }

            // Make sure custom modifiers and bounds are the same.
            if ((comparison & TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds) == 0)
            {
                var mod      = this.CustomModifiers;
                var otherMod = other.CustomModifiers;
                var count    = mod.Length;

                if (count != otherMod.Length)
                {
                    return(false);
                }

                for (int i = 0; i < count; i++)
                {
                    if (!mod[i].Equals(otherMod[i]))
                    {
                        return(false);
                    }
                }

                if (!this.HasSameSizesAndLowerBoundsAs(other))
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        private bool Equals(ArrayTypeSymbol other, TypeCompareKind comparison)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if ((object)other == null || !other.HasSameShapeAs(this) ||
                !other.ElementType.Equals(ElementType, comparison))
            {
                return(false);
            }

            // Make sure bounds are the same.
            if ((comparison & TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds) == 0 && !this.HasSameSizesAndLowerBoundsAs(other))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        private bool Equals(ArrayTypeSymbol other, TypeCompareKind comparison, IReadOnlyDictionary <TypeParameterSymbol, bool> isValueTypeOverrideOpt)
        {
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if ((object)other == null || !other.HasSameShapeAs(this) ||
                !other.ElementTypeWithAnnotations.Equals(ElementTypeWithAnnotations, comparison, isValueTypeOverrideOpt))
            {
                return(false);
            }

            // Make sure bounds are the same.
            if ((comparison & TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds) == 0 && !this.HasSameSizesAndLowerBoundsAs(other))
            {
                return(false);
            }

            return(true);
        }