Beispiel #1
0
        bool IEquatable <MetricSystem> .Equals(MetricSystem other)
        {
            if (Utils.VerifyStackOverflow())
            {
                return(Name == other.Name);
            }
            else
            {
                var this_OrderedQuantities  = Quantities.OrderBy(q => q.Name);
                var this_OrderedUnits       = Units.OrderBy(u => u.Name);
                var this_OrderedPrefixes    = Prefixes.OrderBy(p => p.Name);
                var other_OrderedQuantities = Quantities.OrderBy(q => q.Name);
                var other_OrderedUnits      = Units.OrderBy(u => u.Name);
                var other_OrderedPrefixes   = Prefixes.OrderBy(p => p.Name);

                Func <bool> quantitiesMatch = () => this_OrderedQuantities.SequenceEqual(other_OrderedQuantities,
                                                                                         new IEquatableEqualityComparer <Quantity>());
                Func <bool> unitsMatch = () => this_OrderedUnits.SequenceEqual(other_OrderedUnits,
                                                                               new IEquatableEqualityComparer <Unit>());
                Func <bool> metricPrefixesMatch = () => other_OrderedPrefixes.SequenceEqual(other_OrderedPrefixes,
                                                                                            new IEquatableEqualityComparer <MetricPrefix>());

                return(Name == other?.Name && quantitiesMatch() && unitsMatch() &&
                       metricPrefixesMatch());
            }
        }