且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用字段名称作为字符串调用OrderBy()

更新时间:2023-09-05 23:03:10

感谢所有人. Rob,您的解决方案与我最终得到的解决方案非常接近.

Thanks to all. Rob, your solution was pretty close to what I ended up with.

根据您的见解,我进行了更多搜索,并在这里遇到了Marc Gravel的答案在IEnumerable< T> 上进行动态LINQ订购(第二篇文章).

Based on your insights I did some more searching and came across Marc Gravel's answer here Dynamic LINQ OrderBy on IEnumerable<T> (second post).

它增加了动态效果作为额外奖励.

It added dynamic's as an additional bonus.