コード例 #1
0
        public int Compare(TElement x, TElement y)
        {
            int num2;

            if (!this.CanCompare)
            {
                throw new InvalidOperationException(NuGetResources.AggregateQueriesRequireOrder);
            }
            int num = 0;

            using (Stack <Ordering <TElement, TElement> > .Enumerator enumerator = this._orderings.GetEnumerator())
            {
                while (true)
                {
                    if (enumerator.MoveNext())
                    {
                        Ordering <TElement, TElement> current = enumerator.Current;
                        IComparable comparable  = current.Extractor(x);
                        IComparable comparable2 = current.Extractor(y);
                        if ((comparable == null) && (comparable2 == null))
                        {
                            continue;
                        }
                        num = comparable.CompareTo(comparable2);
                        if (num == 0)
                        {
                            continue;
                        }
                        num2 = !current.Descending ? num : -num;
                    }
                    else
                    {
                        return(num);
                    }
                    break;
                }
            }
            return(num2);
        }