protected IEnumerable <RowItem> Sort(CancellationToken cancellationToken, DataSchema dataSchema, ListSortDescriptionCollection sortDescriptions, PivotedRows pivotedRows) { var unsortedRows = pivotedRows.RowItems; if (sortDescriptions == null || sortDescriptions.Count == 0) { return(unsortedRows); } var sortRows = new SortRow[unsortedRows.Count]; for (int iRow = 0; iRow < sortRows.Length; iRow++) { sortRows[iRow] = new SortRow(cancellationToken, dataSchema, sortDescriptions, unsortedRows[iRow], iRow); } Array.Sort(sortRows); return(Array.AsReadOnly(sortRows.Select(sr => sr.RowItem).ToArray())); }
protected IEnumerable <RowItem> Sort(CancellationToken cancellationToken, QueryResults results) { var sortDescriptions = results.Parameters.SortDescriptions; var unsortedRows = results.FilteredRows; if (sortDescriptions == null || sortDescriptions.Count == 0) { return(unsortedRows); } var sortRows = new SortRow[unsortedRows.Count]; for (int iRow = 0; iRow < sortRows.Count(); iRow++) { sortRows[iRow] = new SortRow(cancellationToken, results.Parameters, unsortedRows[iRow], iRow); } Array.Sort(sortRows); return(Array.AsReadOnly(sortRows.Select(sr => sr.RowItem).ToArray())); }