我需要sort
基于col1
除以col2
的结果...所以我想做的是这样的:
var x = uploadsQuerySelectionBuilder.Where(e => e.uploadNumberOfVotes
> 0)**.OrderByDescending(e=>(e.uploadScore/e.uploadNumberOfVotes))
** : uploadsQuerySelectionBuilder;
至于现在..它似乎根本没有订购结果,但它只是随机.. 这甚至是可能的,我怎么能让这个工作?
编辑:
var x = tSearch.SortByDate != false ? uploadsQuerySelectionBuilder.Where(e => e.uploadNumberOfVotes > 0).OrderByDescending(e => (e.uploadScore / e.uploadNumberOfVotes)) : uploadsQuerySelectionBuilder;
是非常有效且“可编译”的代码:) ..另一个不是用VS编写的,所以我的不好......
答案 0 :(得分:0)
类似的东西:
var x = uploadsQuerySelectionBuilder
.Where(e => e.uploadNumberOfVotes > 0)
.Select(e => new { Val = e, ScoreishThing = e.uploadScore/e.uploadNumberOfVotes })
.OrderByDescending(e=> e.ScoreishThing)
.Select(e=>e.Val);