Exemplo n.º 1
0
        public Sorter <T> ByComparison(Func <T, T, Int32> poFunctor, SorterDirection peDirection)
        {
            switch (peDirection)
            {
            case SorterDirection.Ascending:
                _oComparers.Add((x, y) => poFunctor(x, y));
                break;

            case SorterDirection.Descending:
                _oComparers.Add((x, y) => _InvertResult(poFunctor(x, y)));
                break;
            }

            return(this);
        }
Exemplo n.º 2
0
        public Sorter <T> ByExpression(Func <T, Boolean> poFunctor, SorterDirection peDirection)
        {
            switch (peDirection)
            {
            case SorterDirection.Ascending:
                _oComparers.Add((x, y) => _CompareTwoBooleans(poFunctor(x), poFunctor(y)));
                break;

            case SorterDirection.Descending:
                _oComparers.Add((x, y) => _InvertResult(_CompareTwoBooleans(poFunctor(x), poFunctor(y))));
                break;
            }

            return(this);
        }
Exemplo n.º 3
0
        public Sorter <T> ByComparison <P> (Func <T, P> poFunctor, SorterDirection peDirection)
        {
            switch (peDirection)
            {
            case SorterDirection.Ascending:
                _oComparers.Add((x, y) => Comparer <P> .Default.Compare(poFunctor(x), poFunctor(y)));
                break;

            case SorterDirection.Descending:
                _oComparers.Add((x, y) => _InvertResult(Comparer <P> .Default.Compare(poFunctor(x), poFunctor(y))));
                break;
            }

            return(this);
        }
 public CAMLQueryBuilder AddSorting(string fieldName, SorterDirection direction) {
     return AddSorter(new Sorter() {
         FieldName = fieldName,
         Direction = direction
     });
 }