public bool Equals()

in src/lib/Microsoft.Fx.Portability/ObjectModel/IgnoreAssemblyInfo.cs [19:59]


        public bool Equals(IgnoreAssemblyInfo other)
        {
            if (other == null)
            {
                return false;
            }

            if (!AssemblyIdentity.Equals(other.AssemblyIdentity, StringComparison.OrdinalIgnoreCase))
            {
                return false;
            }

            if (TargetsIgnored == null || TargetsIgnored.Count() == 0)
            {
                if (other.TargetsIgnored != null && other.TargetsIgnored.Count() > 0)
                {
                    return false;
                }
            }
            else
            {
                // We could just look to see that all of the targets ignored by either object are ignored by the other, but this way
                // will prevent duplicates which is desirable since the merge method should make it easy for user to not have duplicate targets
                if (TargetsIgnored.Count() != (other.TargetsIgnored == null ? 0 : other.TargetsIgnored.Count()))
                {
                    return false;
                }

                var sortedTargetsEnum = TargetsIgnored.OrderBy(s => s).GetEnumerator();
                var sortedOtherTargetsEnum = other.TargetsIgnored.OrderBy(s => s).GetEnumerator();
                while (sortedTargetsEnum.MoveNext() && sortedOtherTargetsEnum.MoveNext())
                {
                    if (!sortedTargetsEnum.Current.Equals(sortedOtherTargetsEnum.Current, StringComparison.OrdinalIgnoreCase))
                    {
                        return false;
                    }
                }
            }

            return true;
        }