0

我开发了一个分页服务来使用 NHibernate 从数据库中检索数据。在我的实际观点中,我收到了一个跳过、获取和字符串顺序参数。

我的问题是,在 .NET 中存在一些用于排序的本机库,考虑 asc 或 desc 排序的东西,也许是要优先排序的字段列表。

例如:订单名称 Asc,City Desc。

所以:
保罗| 纽约
保罗 | 阿姆斯特丹

-- 编辑

IEnumerable<Obj> actuals = _repository.LoadByName("Pa", p => p.Name);

和方法签名:

public IEnumerable<Obj> LoadByName<TKey> (string name, Func<Obj, TKey> ordering = null, int skip = 0, int take = 0) {
4

2 回答 2

2

LINQ --> OrderBy , ThenByDescending

于 2011-06-15T13:41:34.057 回答
0

List<T>有一个排序方法。

于 2011-06-15T13:40:46.747 回答