コード例 #1
0
        /// <summary>
        /// Create an order with one order specified.
        /// </summary>
        /// <param name="orderExpr">
        /// The order expr.
        /// </param>
        /// <param name="sortDirection">
        /// The sort Direction.
        /// </param>
        /// <typeparam name="TOrderProperty">
        /// The property being ordered by.
        /// </typeparam>
        /// <returns>
        /// A new ordercooodrinator.
        /// </returns>
        public static OrderCoordinator <T> OneOrder <TOrderProperty>(Expression <Func <T, TOrderProperty> > orderExpr, SortDirection sortDirection)
        {
            var result = new OrderCoordinator <T>();

            result.Orders.Add(new Orderer <T, TOrderProperty>(orderExpr, sortDirection));

            return(result);
        }
コード例 #2
0
        public void Test()
        {
            OrderCoordinator <FileInfo> coord = new OrderCoordinator <FileInfo>();

            coord.Orders.Add(new Orderer <FileInfo, string>(c => c.Name, SortDirection.Ascending));
            coord.Orders.Add(new Orderer <FileInfo, long>(c => c.Length, SortDirection.Ascending));

            IQueryable <FileInfo> query = Enumerable.Empty <FileInfo>().AsQueryable();

            query = coord.ApplyOrders(query);

            string result = query.Expression.ToString();
        }